add graceful handling of bogus actor types in import
This commit is contained in:
@@ -365,6 +365,10 @@ namespace OpenRA.Editor
|
|||||||
//Structures: num=owner,type,health,location,turret-facing,trigger
|
//Structures: num=owner,type,health,location,turret-facing,trigger
|
||||||
//Units: num=owner,type,health,location,facing,action,trigger
|
//Units: num=owner,type,health,location,facing,action,trigger
|
||||||
//Infantry: num=owner,type,health,location,subcell,action,facing,trigger
|
//Infantry: num=owner,type,health,location,subcell,action,facing,trigger
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
var parts = s.Value.Split(',');
|
var parts = s.Value.Split(',');
|
||||||
var loc = int.Parse(parts[3]);
|
var loc = int.Parse(parts[3]);
|
||||||
if (parts[0] == "")
|
if (parts[0] == "")
|
||||||
@@ -375,7 +379,7 @@ namespace OpenRA.Editor
|
|||||||
Players.Add(parts[0]);
|
Players.Add(parts[0]);
|
||||||
|
|
||||||
var stance = ActorStance.Stance.None;
|
var stance = ActorStance.Stance.None;
|
||||||
switch(parts[5])
|
switch (parts[5])
|
||||||
{
|
{
|
||||||
case "Area Guard":
|
case "Area Guard":
|
||||||
case "Guard":
|
case "Guard":
|
||||||
@@ -411,8 +415,15 @@ namespace OpenRA.Editor
|
|||||||
if (section == "INFANTRY")
|
if (section == "INFANTRY")
|
||||||
actor.Add(new SubCellInit(int.Parse(parts[4])));
|
actor.Add(new SubCellInit(int.Parse(parts[4])));
|
||||||
|
|
||||||
Map.Actors.Value.Add("Actor" + ActorCount++,actor);
|
if (!Rules.Info.ContainsKey(parts[1].ToLowerInvariant()))
|
||||||
|
errorHandler("Ignoring unknown actor type: `{0}`".F(parts[1].ToLowerInvariant()));
|
||||||
|
else
|
||||||
|
Map.Actors.Value.Add("Actor" + ActorCount++, actor);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
errorHandler("Malformed actor definition: `{0}`".F(s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user