Prevent bots crash when there's no waypoints

This commit is contained in:
Sally Coolatta 2022-05-28 03:58:49 -04:00
parent f1e119527d
commit 286f1c34a5

View file

@ -1270,13 +1270,9 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
// Remove any existing controls
memset(cmd, 0, sizeof(ticcmd_t));
if (gamestate != GS_LEVEL
|| player->mo->scale <= 1
|| player->playerstate == PST_DEAD
|| leveltime <= introtime
|| !(gametyperules & GTR_BOTS))
if (gamestate != GS_LEVEL)
{
// No need to do anything else.
// Not in a level.
return;
}
@ -1286,6 +1282,16 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
return;
}
if (!(gametyperules & GTR_BOTS) // No bot behaviors
|| K_GetNumWaypoints() == 0 // No waypoints
|| leveltime <= introtime // During intro camera
|| player->playerstate == PST_DEAD // Dead, respawning.
|| player->mo->scale <= 1) // Post-finish "death" animation
{
// No need to do anything else.
return;
}
botController = K_FindBotController(player->mo);
if (botController == NULL)
{