Skip to content

Commit

Permalink
Rework automatic updatemapfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Vegetal-Pole committed May 1, 2024
1 parent cd1ca42 commit 127f3b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 3 additions & 1 deletion TagTool/Commands/Files/UpdateMapFilesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ public override object Execute(List<string> args)
var scnr = Cache.Deserialize<Scenario>(tagStream, scenario);

var mapBuilder = new MapFileBuilder(Cache.Version);
mapBuilder.MapInfo = mapInfo.Scenario;
if (mapInfo != null)
mapBuilder.MapInfo = mapInfo.Scenario;

map = mapBuilder.Build(scenario, scnr);
}

Expand Down
12 changes: 5 additions & 7 deletions TagTool/Commands/Porting/PortTagCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public partial class PortTagCommand : Command
};

private readonly Dictionary<Tag, CachedTag> DefaultTags = new Dictionary<Tag, CachedTag> { };
private bool ScenarioPort = false;

public PortTagCommand(GameCacheHaloOnlineBase cacheContext, GameCache blamCache) :
base(true,
Expand Down Expand Up @@ -168,6 +169,9 @@ public override object Execute(List<string> args)

ProcessDeferredActions();

if (ScenarioPort && FlagIsSet(PortingFlags.UpdateMapFiles))
new UpdateMapFilesCommand(CacheContext).Execute(new List<string> { });

return true;
}

Expand Down Expand Up @@ -1256,13 +1260,7 @@ public CachedTag ConvertTagInternal(Stream cacheStream, Stream blamCacheStream,
}
}

if (Flags.HasFlag(PortingFlags.UpdateMapFiles))
{
_deferredActions.Add(() =>
{
new UpdateMapFilesCommand(CacheContext).Execute(new List<string> { });
});
}
ScenarioPort = true;
}
break;

Expand Down

0 comments on commit 127f3b2

Please sign in to comment.