Added a failsafe to randomized player selection in maybe_drop_net_powerup() that will prevent the loop to hang and go with Player_num instead
This commit is contained in:
parent
cf512cd368
commit
8d69b1924b
|
@ -621,9 +621,16 @@ void maybe_drop_net_powerup(powerup_type_t powerup_type, bool adjust_cap, bool r
|
|||
|
||||
if (random_player)
|
||||
{
|
||||
pnum = d_rand() % MAX_PLAYERS;
|
||||
while( Players[pnum].connected != CONNECT_PLAYING )
|
||||
uint_fast32_t failsafe_count = 0;
|
||||
do {
|
||||
pnum = d_rand() % MAX_PLAYERS;
|
||||
if (failsafe_count > MAX_PLAYERS*4) // that was plenty of tries to find a good player...
|
||||
{
|
||||
pnum = Player_num; // ... go with Player_num instead
|
||||
break;
|
||||
}
|
||||
failsafe_count++;
|
||||
} while (Players[pnum].connected != CONNECT_PLAYING);
|
||||
}
|
||||
|
||||
//--old-- segnum = (d_rand() * Highest_segment_index) >> 15;
|
||||
|
|
Loading…
Reference in a new issue