first step: Race -> string
This commit is contained in:
@@ -108,7 +108,7 @@ namespace OpenRA.Server
|
|||||||
Index = newConn.PlayerIndex,
|
Index = newConn.PlayerIndex,
|
||||||
PaletteIndex = ChooseFreePalette(),
|
PaletteIndex = ChooseFreePalette(),
|
||||||
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
||||||
Race = 1,
|
Race = "allies", /* hack */
|
||||||
State = Session.ClientState.NotReady
|
State = Session.ClientState.NotReady
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -249,14 +249,7 @@ namespace OpenRA.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int race;
|
GetClient(conn).Race = s;
|
||||||
if (!int.TryParse(s, out race) || race < 0 || race > 1)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Invalid race: {0}", s);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetClient(conn).Race = 1 + race;
|
|
||||||
SyncLobbyInfo();
|
SyncLobbyInfo();
|
||||||
return true;
|
return true;
|
||||||
}},
|
}},
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRa.FileFormats
|
|||||||
{
|
{
|
||||||
public int Index;
|
public int Index;
|
||||||
public int PaletteIndex;
|
public int PaletteIndex;
|
||||||
public int Race;
|
public string Race;
|
||||||
public int SpawnPoint;
|
public int SpawnPoint;
|
||||||
public string Name;
|
public string Name;
|
||||||
public ClientState State;
|
public ClientState State;
|
||||||
|
|||||||
@@ -153,10 +153,10 @@ namespace OpenRa
|
|||||||
{
|
{
|
||||||
DrawDownloadBar();
|
DrawDownloadBar();
|
||||||
|
|
||||||
chromeCollection = (world.LocalPlayer.Race == Race.Allies) ? "chrome-allies" : "chrome-soviet";
|
chromeCollection = "chrome-" + world.LocalPlayer.Race;
|
||||||
radarCollection = (world.LocalPlayer.Race == Race.Allies) ? "radar-allies" : "radar-soviet";
|
radarCollection = "radar-" + world.LocalPlayer.Race;
|
||||||
paletteCollection = (world.LocalPlayer.Race == Race.Allies) ? "palette-allies" : "palette-soviet";
|
paletteCollection = "palette-" + world.LocalPlayer.Race;
|
||||||
digitCollection = (world.LocalPlayer.Race == Race.Allies) ? "digits-allies" : "digits-soviet";
|
digitCollection = "digits-" + world.LocalPlayer.Race;
|
||||||
|
|
||||||
buttons.Clear();
|
buttons.Clear();
|
||||||
|
|
||||||
@@ -362,8 +362,9 @@ namespace OpenRa
|
|||||||
|
|
||||||
void CycleRace(bool left)
|
void CycleRace(bool left)
|
||||||
{
|
{
|
||||||
Game.IssueOrder(
|
// hack
|
||||||
Order.Chat("/race " + (((int)Game.world.LocalPlayer.Race - 1) ^ 1)));
|
var newRace = Game.world.LocalPlayer.Race == RaceUtil.Allies ? RaceUtil.Soviet : RaceUtil.Allies;
|
||||||
|
Game.IssueOrder(Order.Chat("/race " + newRace));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CycleReady(bool left)
|
void CycleReady(bool left)
|
||||||
@@ -466,7 +467,7 @@ namespace OpenRa
|
|||||||
paletteRect.Bottom+Game.viewport.Location.Y - 5),
|
paletteRect.Bottom+Game.viewport.Location.Y - 5),
|
||||||
Player.PlayerColors[client.PaletteIndex].c);
|
Player.PlayerColors[client.PaletteIndex].c);
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
renderer.DrawText(((Race)client.Race).ToString(), new int2(r.Left + 220, y), Color.White);
|
renderer.DrawText(client.Race, new int2(r.Left + 220, y), Color.White);
|
||||||
renderer.DrawText(client.State.ToString(), new int2(r.Left + 290, y), Color.White);
|
renderer.DrawText(client.State.ToString(), new int2(r.Left + 290, y), Color.White);
|
||||||
renderer.DrawText((client.SpawnPoint == 0)? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White);
|
renderer.DrawText((client.SpawnPoint == 0)? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White);
|
||||||
y += 30;
|
y += 30;
|
||||||
@@ -568,7 +569,7 @@ namespace OpenRa
|
|||||||
string[] tabKeys = { "normal", "ready", "selected" };
|
string[] tabKeys = { "normal", "ready", "selected" };
|
||||||
var producing = queue.CurrentItem(groupName);
|
var producing = queue.CurrentItem(groupName);
|
||||||
var index = q.Key == currentTab ? 2 : (producing != null && producing.Done) ? 1 : 0;
|
var index = q.Key == currentTab ? 2 : (producing != null && producing.Done) ? 1 : 0;
|
||||||
var race = (world.LocalPlayer.Race == Race.Allies) ? "allies" : "soviet";
|
var race = world.LocalPlayer.Race;
|
||||||
rgbaRenderer.DrawSprite(ChromeProvider.GetImage(renderer,"tabs-"+tabKeys[index], race+"-"+q.Key), new float2(x, y), "chrome");
|
rgbaRenderer.DrawSprite(ChromeProvider.GetImage(renderer,"tabs-"+tabKeys[index], race+"-"+q.Key), new float2(x, y), "chrome");
|
||||||
|
|
||||||
buttons.Add(Pair.New(new RectangleF(x, y, tabWidth, tabHeight),
|
buttons.Add(Pair.New(new RectangleF(x, y, tabWidth, tabHeight),
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using OpenRa.GameRules;
|
|
||||||
using OpenRa.Effects;
|
using OpenRa.Effects;
|
||||||
|
using OpenRa.GameRules;
|
||||||
using OpenRa.Traits;
|
using OpenRa.Traits;
|
||||||
|
|
||||||
namespace OpenRa
|
namespace OpenRa
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using IjwFramework.Types;
|
using IjwFramework.Types;
|
||||||
using IjwFramework.Collections;
|
|
||||||
|
|
||||||
namespace OpenRa.GameRules
|
namespace OpenRa.GameRules
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRa.GameRules;
|
|
||||||
using OpenRa.Graphics;
|
|
||||||
using OpenRa.Traits;
|
|
||||||
using OpenRa.FileFormats;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRa.FileFormats;
|
||||||
|
using OpenRa.Traits;
|
||||||
|
|
||||||
namespace OpenRa
|
namespace OpenRa
|
||||||
{
|
{
|
||||||
@@ -18,7 +16,7 @@ namespace OpenRa
|
|||||||
public int Kills;
|
public int Kills;
|
||||||
public string PlayerName;
|
public string PlayerName;
|
||||||
public string InternalName;
|
public string InternalName;
|
||||||
public Race Race;
|
public string Race;
|
||||||
public readonly int Index;
|
public readonly int Index;
|
||||||
public int Cash = 10000;
|
public int Cash = 10000;
|
||||||
public int Ore = 0;
|
public int Ore = 0;
|
||||||
@@ -64,7 +62,7 @@ namespace OpenRa
|
|||||||
|
|
||||||
this.PaletteIndex = client != null ? client.PaletteIndex : index;
|
this.PaletteIndex = client != null ? client.PaletteIndex : index;
|
||||||
this.PlayerName = client != null ? client.Name : "Player {0}".F(index+1);
|
this.PlayerName = client != null ? client.Name : "Player {0}".F(index+1);
|
||||||
this.Race = client != null ? (Race)client.Race : Race.Allies;
|
this.Race = client != null ? client.Race : RaceUtil.Allies;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePower()
|
void UpdatePower()
|
||||||
@@ -179,10 +177,10 @@ namespace OpenRa
|
|||||||
PlayerName = client.Name;
|
PlayerName = client.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Race != (Race)client.Race)
|
if (Race != client.Race)
|
||||||
{
|
{
|
||||||
Game.chat.AddLine(this, "is now playing {0}".F((Race)client.Race));
|
Game.chat.AddLine(this, "is now playing {0}".F(client.Race));
|
||||||
Race = (Race)client.Race;
|
Race = client.Race;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PaletteIndex != client.PaletteIndex)
|
if (PaletteIndex != client.PaletteIndex)
|
||||||
|
|||||||
@@ -2,11 +2,20 @@ using System;
|
|||||||
|
|
||||||
namespace OpenRa
|
namespace OpenRa
|
||||||
{
|
{
|
||||||
[Flags]
|
public static class RaceUtil
|
||||||
public enum Race
|
|
||||||
{
|
{
|
||||||
None = 0,
|
/* just while we do the transition */
|
||||||
Allies = 1,
|
public static readonly string Allies = "allies";
|
||||||
Soviet = 2
|
public static readonly string Soviet = "soviet";
|
||||||
|
|
||||||
|
public static readonly string DefaultRace = Allies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//[Flags]
|
||||||
|
//public enum Race
|
||||||
|
//{
|
||||||
|
// None = 0,
|
||||||
|
// Allies = 1,
|
||||||
|
// Soviet = 2
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using IjwFramework.Collections;
|
using IjwFramework.Collections;
|
||||||
using OpenRa.FileFormats;
|
using OpenRa.FileFormats;
|
||||||
using OpenRa.Traits;
|
|
||||||
using OpenRa.Support;
|
using OpenRa.Support;
|
||||||
using System.Runtime.InteropServices;
|
using OpenRa.Traits;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace OpenRa
|
namespace OpenRa
|
||||||
{
|
{
|
||||||
@@ -110,7 +109,7 @@ namespace OpenRa
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var variants = (voicedUnit.Owner.Race == Race.Soviet)
|
var variants = (voicedUnit.Owner.Race == RaceUtil.Soviet)
|
||||||
? vi.SovietVariants : vi.AlliedVariants;
|
? vi.SovietVariants : vi.AlliedVariants;
|
||||||
|
|
||||||
var variant = variants[voicedUnit.ActorID % variants.Length];
|
var variant = variants[voicedUnit.ActorID % variants.Length];
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace OpenRa.Traits
|
|||||||
public readonly int TechLevel = -1;
|
public readonly int TechLevel = -1;
|
||||||
public readonly string[] Prerequisites = { };
|
public readonly string[] Prerequisites = { };
|
||||||
public readonly string[] BuiltAt = { };
|
public readonly string[] BuiltAt = { };
|
||||||
public readonly Race[] Owner = { };
|
public readonly string[] Owner = { };
|
||||||
public readonly int Cost = 0;
|
public readonly int Cost = 0;
|
||||||
public readonly string Description = "";
|
public readonly string Description = "";
|
||||||
public readonly string LongDesc = "";
|
public readonly string LongDesc = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user