Fixed errors when saving checkpoints on inactive bots.

This commit is contained in:
shavit 2018-03-24 01:46:09 +03:00
parent 8a7d3d4de0
commit 4176d68b86
2 changed files with 12 additions and 0 deletions

View File

@ -1692,6 +1692,13 @@ bool SaveCheckpoint(int client, int index)
int style = Shavit_GetReplayBotStyle(target);
int track = Shavit_GetReplayBotTrack(target);
if(style < 0 || track < 0)
{
Shavit_PrintToChat(client, "%T", "CommandAliveSpectate", client, gS_ChatStrings[sMessageVariable], gS_ChatStrings[sMessageText], gS_ChatStrings[sMessageVariable], gS_ChatStrings[sMessageText]);
return false;
}
snapshot[bTimerEnabled] = true;
snapshot[fCurrentTime] = Shavit_GetReplayTime(style, track);
snapshot[bClientPaused] = false;

View File

@ -401,6 +401,11 @@ public int Native_GetReplayTime(Handle handler, int numParams)
int style = GetNativeCell(1);
int track = GetNativeCell(2);
if(style < 0 || track < 0)
{
return view_as<int>(0.0);
}
if(gB_CentralBot)
{
if(gA_CentralCache[iCentralReplayStatus] == Replay_End)