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