1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 00:04:43 +01:00

Add normalisation support to remove gaps.

This commit is contained in:
Matt
2018-12-11 08:13:47 +01:00
parent b6c2dca849
commit df0cc72887
5 changed files with 236 additions and 39 deletions

View File

@@ -1438,6 +1438,36 @@ static int32_t cc_replay_stop(InteractiveConsole& console, const utf8** argv, in
return 0;
}
static int32_t cc_replay_normalise(InteractiveConsole& console, const utf8** argv, int32_t argc)
{
if (network_get_mode() != NETWORK_MODE_NONE)
{
console.WriteFormatLine("This command is currently not supported in multiplayer mode.");
return 0;
}
if (argc < 2)
{
console.WriteFormatLine("Parameters required <replay_input> <replay_output>");
return 0;
}
std::string inputFile = argv[0];
std::string outputFile = argv[1];
auto* replayManager = OpenRCT2::GetContext()->GetReplayManager();
if (replayManager != nullptr)
{
if (replayManager->NormaliseReplay(inputFile, outputFile))
{
console.WriteFormatLine("Stopped replay");
return 1;
}
}
return 0;
}
#pragma warning(push)
#pragma warning(disable : 4702) // unreachable code
static int32_t cc_abort(
@@ -1561,6 +1591,8 @@ static constexpr const console_command console_command_table[] = {
{ "replay_stoprecord", cc_replay_stoprecord, "Stops recording a new replay.", "replay_stoprecord"},
{ "replay_start", cc_replay_start, "Starts a replay", "replay_start <name>"},
{ "replay_stop", cc_replay_stop, "Stops the replay", "replay_stop"},
{ "replay_normalise", cc_replay_normalise, "Normalises the replay to remove all gaps", "replay_normalise <input file> <output file>"},
};
// clang-format on