forked from rosebudai/OpenRCT2-Web
Show error message when issuing replay_start with a nonexistent file
This commit is contained in:
1 parent
cc1e217a90
commit
b1103708ea
6 files changed
+88
-41
No files matched your search
@@ -1485,25 +1485,33 @@ static void ConsoleCommandReplayStart(InteractiveConsole& console, const argumen
|
||||
std::string name = argv[0];
|
||||
|
||||
auto* replayManager = OpenRCT2::GetContext()->GetReplayManager();
|
||||
if (replayManager->StartPlayback(name))
|
||||
|
||||
try
|
||||
{
|
||||
OpenRCT2::ReplayRecordInfo info;
|
||||
replayManager->GetCurrentReplayInfo(info);
|
||||
|
||||
std::time_t ts = info.TimeRecorded;
|
||||
|
||||
char recordingDate[128] = {};
|
||||
std::strftime(recordingDate, sizeof(recordingDate), "%c", std::localtime(&ts));
|
||||
|
||||
const char* logFmt = "Replay playback started: %s\n"
|
||||
" Date Recorded: %s\n"
|
||||
" Ticks: %u\n"
|
||||
" Commands: %u\n"
|
||||
" Checksums: %u";
|
||||
|
||||
console.WriteFormatLine(logFmt, info.FilePath.c_str(), recordingDate, info.Ticks, info.NumCommands, info.NumChecksums);
|
||||
Console::WriteLine(logFmt, info.FilePath.c_str(), recordingDate, info.Ticks, info.NumCommands, info.NumChecksums);
|
||||
replayManager->StartPlayback(name);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
console.WriteLine(e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
OpenRCT2::ReplayRecordInfo info;
|
||||
replayManager->GetCurrentReplayInfo(info);
|
||||
|
||||
std::time_t ts = info.TimeRecorded;
|
||||
|
||||
char recordingDate[128] = {};
|
||||
std::strftime(recordingDate, sizeof(recordingDate), "%c", std::localtime(&ts));
|
||||
|
||||
const char* logFmt = "Replay playback started: %s\n"
|
||||
" Date Recorded: %s\n"
|
||||
" Ticks: %u\n"
|
||||
" Commands: %u\n"
|
||||
" Checksums: %u";
|
||||
|
||||
console.WriteFormatLine(logFmt, info.FilePath.c_str(), recordingDate, info.Ticks, info.NumCommands, info.NumChecksums);
|
||||
Console::WriteLine(logFmt, info.FilePath.c_str(), recordingDate, info.Ticks, info.NumCommands, info.NumChecksums);
|
||||
}
|
||||
|
||||
static void ConsoleCommandReplayStop(InteractiveConsole& console, const arguments_t& argv)
|
||||
|
||||
Reference in new issue
Block a user