mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Set a default botleader if we don't have one (resolves #717)
This commit is contained in:
parent
4b9d40b911
commit
243a797efe
1 changed files with 7 additions and 2 deletions
|
@ -29,11 +29,16 @@ void B_UpdateBotleader(player_t *player)
|
|||
{
|
||||
if (players[i].bot || players[i].playerstate != PST_LIVE || players[i].spectator || !players[i].mo)
|
||||
continue;
|
||||
if (!player->mo) //Can't do distance calculations if there's no player object, so we'll just take the first we find
|
||||
|
||||
if (!player->botleader)
|
||||
{
|
||||
player->botleader = &players[i];
|
||||
player->botleader = &players[i]; // set default
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->mo)
|
||||
return;
|
||||
|
||||
//Update best candidate based on nearest distance
|
||||
dist = R_PointToDist2(player->mo->x, player->mo->y, players[i].mo->x, players[i].mo->y);
|
||||
if (neardist > dist)
|
||||
|
|
Loading…
Reference in a new issue