From 286f1c34a5fb7aa461c8493f1f40c25405213bce Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 28 May 2022 03:58:49 -0400 Subject: [PATCH] Prevent bots crash when there's no waypoints --- src/k_bot.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/k_bot.c b/src/k_bot.c index 5664a7193..b2115bbea 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -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) {