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
|
||||
//Units: num=owner,type,health,location,facing,action,trigger
|
||||
//Infantry: num=owner,type,health,location,subcell,action,facing,trigger
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
var parts = s.Value.Split(',');
|
||||
var loc = int.Parse(parts[3]);
|
||||
if (parts[0] == "")
|
||||
@@ -411,8 +415,15 @@ namespace OpenRA.Editor
|
||||
if (section == "INFANTRY")
|
||||
actor.Add(new SubCellInit(int.Parse(parts[4])));
|
||||
|
||||
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