Remove some of the weirder quirks of timeout killgoal handling

Require that at least one player have at least one kill.  If all players
have at most zero kills, return without declaring a winner.
This commit is contained in:
Kp 2016-12-10 17:51:11 +00:00
parent 87be333d29
commit 3e2150c470

View file

@ -3859,19 +3859,11 @@ void multi_check_for_killgoal_winner ()
* routine always chooses the lowest index player. No opportunity * routine always chooses the lowest index player. No opportunity
* is provided for the players to score a tie-breaking kill, nor * is provided for the players to score a tie-breaking kill, nor
* is any other property (such as remaining shields) considered. * is any other property (such as remaining shields) considered.
* - This routine has no special handling for the case that all * Historical versions had additional quirks relating to
* players are tied at zero kills. It will choose the lowest * zero/negative kills, but those quirks have been removed.
* index player, despite no player having any kills.
* - This routine has no special handling for the case that all
* players have _negative_ kills, which can happen if players die
* a penalized death (such as being killed by the reactor) and do
* not score an equal or greater number of approved kills. If all
* players have negative kills, then this routine will choose
* player 0, rather than the player with the kill count closest to
* zero.
*/ */
const auto &local_player = get_local_player(); const auto &local_player = get_local_player();
const player *bestplr = &Players[0]; const player *bestplr = nullptr;
int highest_kill_goal_count = 0; int highest_kill_goal_count = 0;
range_for (auto &i, partial_const_range(Players, N_players)) range_for (auto &i, partial_const_range(Players, N_players))
{ {
@ -3884,6 +3876,9 @@ void multi_check_for_killgoal_winner ()
bestplr = &i; bestplr = &i;
} }
} }
if (!bestplr)
/* No player has at least one kill */
return;
if (bestplr == &local_player) if (bestplr == &local_player)
{ {