Skip to content

Commit

Permalink
Fix subcells imported from Gen1 maps
Browse files Browse the repository at this point in the history
  • Loading branch information
JovialFeline committed Apr 12, 2024
1 parent 150e28a commit cd7ae5d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion OpenRA.Mods.Cnc/UtilityCommands/ImportGen1MapCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,19 @@ public void LoadActors(IniFile file, string section, List<string> players, Map m
actor.Add(new FacingInit(new WAngle(1024 - 4 * facing)));

if (section == "INFANTRY")
actor.Add(new SubCellInit((SubCell)Exts.ParseByteInvariant(parts[4])));
{
var subcell = 0;
switch (Exts.ParseByteInvariant(parts[4]))
{
case 1: subcell = 1; break;
case 2: subcell = 2; break;
case 3: subcell = 4; break;
case 4: subcell = 5; break;
}

if (subcell != 0)
actor.Add(new SubCellInit((SubCell)subcell));
}

if (!map.Rules.Actors.ContainsKey(parts[1].ToLowerInvariant()))
Console.WriteLine($"Ignoring unknown actor type: `{parts[1].ToLowerInvariant()}`");
Expand Down

0 comments on commit cd7ae5d

Please sign in to comment.