mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-03 05:32:54 +00:00
Prevent bots crash when there's no waypoints
This commit is contained in:
parent
f1e119527d
commit
286f1c34a5
1 changed files with 12 additions and 6 deletions
18
src/k_bot.c
18
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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue