Sanity checked frameNumber; finished TODO on UnitInfo.Owner
This commit is contained in:
@@ -33,7 +33,7 @@ namespace OpenRa.Game.GameRules
|
|||||||
public readonly int GuardRange = -1; // -1 = use weapon's range
|
public readonly int GuardRange = -1; // -1 = use weapon's range
|
||||||
public readonly string Image = null; // sprite-set to use when rendering
|
public readonly string Image = null; // sprite-set to use when rendering
|
||||||
public readonly bool Invisible = false;
|
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 int Points = 0;
|
||||||
public readonly string[] Prerequisite = { };
|
public readonly string[] Prerequisite = { };
|
||||||
public readonly string Primary = null;
|
public readonly string Primary = null;
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ namespace OpenRa.Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
++frameNumber;
|
++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" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,14 @@ namespace OpenRa.TechTree
|
|||||||
sovietPrerequisites = pre.b;
|
sovietPrerequisites = pre.b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Race ParseOwner(string owners, bool doubleOwned)
|
static Race ParseOwner(string[] owners, bool doubleOwned)
|
||||||
{
|
{
|
||||||
if (doubleOwned)
|
if (doubleOwned)
|
||||||
return Race.Allies | Race.Soviet;
|
return Race.Allies | Race.Soviet;
|
||||||
|
|
||||||
Race race = Race.None;
|
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);
|
race |= (Race)Enum.Parse(typeof(Race), s, true);
|
||||||
|
|
||||||
return race;
|
return race;
|
||||||
|
|||||||
Reference in New Issue
Block a user