mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-29 15:42:03 +00:00
Merge branch 'fixlazytails' into 'next'
Set a default botleader if we don't have one (resolves #717) Closes #717 See merge request STJr/SRB2!1683
This commit is contained in:
commit
6cb6cc5afb
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)
|
if (players[i].bot || players[i].playerstate != PST_LIVE || players[i].spectator || !players[i].mo)
|
||||||
continue;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!player->mo)
|
||||||
|
return;
|
||||||
|
|
||||||
//Update best candidate based on nearest distance
|
//Update best candidate based on nearest distance
|
||||||
dist = R_PointToDist2(player->mo->x, player->mo->y, players[i].mo->x, players[i].mo->y);
|
dist = R_PointToDist2(player->mo->x, player->mo->y, players[i].mo->x, players[i].mo->y);
|
||||||
if (neardist > dist)
|
if (neardist > dist)
|
||||||
|
|
Loading…
Reference in a new issue