Project

General

Profile

Bug #383 » 0051-Adjust-nationality-of-remaining-units-after-player-r.patch

main, S3_2, S3_1 - Marko Lindqvist, 03/31/2024 06:39 PM

View differences:

common/player.c
}
/*******************************************************************//**
Clear all player data. If full is set, then the nation and the team will
be cleared too.
Clear all player data.
If full is set, also
- The nation is cleared
- The team is cleared
- Nationality information of remaining units is adjusted
***********************************************************************/
void player_clear(struct player *pplayer, bool full)
{
......
if (full) {
team_remove_player(pplayer);
players_iterate_alive(owner) {
unit_list_iterate(owner->units, owned) {
if (unit_nationality(owned) == pplayer) {
/* Switch nationality to that of current owner. */
owned->nationality = owner;
}
} unit_list_iterate_end;
} players_iterate_alive_end;
/* This comes last because log calls in the above functions
* may use it. */
if (pplayer->nation != NULL) {
(1-1/2)