Sanity checked frameNumber; finished TODO on UnitInfo.Owner

This commit is contained in:
Bob
2009-10-29 20:22:40 +13:00
parent 704dd5a885
commit 318a1c40dd
3 changed files with 6 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ namespace OpenRa.Game.GameRules
public readonly int GuardRange = -1; // -1 = use weapon's range
public readonly string Image = null; // sprite-set to use when rendering
public readonly bool Invisible = false;
public readonly string Owner = "allies,soviet"; // TODO: make this an enum
public readonly string[] Owner = { "allies", "soviet" };
public readonly int Points = 0;
public readonly string[] Prerequisite = { };
public readonly string Primary = null;

View File

@@ -44,6 +44,9 @@ namespace OpenRa.Game
}
}
++frameNumber;
// sanity check on the framenumber. This is 2^31 frames maximum, or multiple *years* at 40ms/frame.
if( ( frameNumber & 0x80000000 ) != 0 )
throw new InvalidOperationException( "(OrderManager) Frame number too large" );
}
}

View File

@@ -25,15 +25,14 @@ namespace OpenRa.TechTree
sovietPrerequisites = pre.b;
}
static Race ParseOwner(string owners, bool doubleOwned)
static Race ParseOwner(string[] owners, bool doubleOwned)
{
if (doubleOwned)
return Race.Allies | Race.Soviet;
Race race = Race.None;
string[] frags = owners.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in frags)
foreach (string s in owners)
race |= (Race)Enum.Parse(typeof(Race), s, true);
return race;