(svn r12906) -Fix: vehicle groups, engine replacement rules and player/company names were not properly reset/freed after bankrupt (before new player start)

This commit is contained in:
smatz
2008-04-26 14:20:39 +00:00
parent 805e1db332
commit 9e1b8b69e3
2 changed files with 16 additions and 3 deletions

View File

@@ -44,6 +44,7 @@
#include "rail_map.h"
#include "signal_func.h"
#include "gfx_func.h"
#include "autoreplace_func.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -454,6 +455,19 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
UpdateSignalsInBuffer();
}
/* In all cases clear replace engine rules.
* Even if it was copied, it could interfere with new owner's rules */
RemoveAllEngineReplacementForPlayer(GetPlayer(old_player));
if (new_player == PLAYER_SPECTATOR) {
RemoveAllGroupsForPlayer(old_player);
} else {
Group *g;
FOR_ALL_GROUPS(g) {
if (g->owner == old_player) g->owner = new_player;
}
}
/* Change color of existing windows */
if (new_player != PLAYER_SPECTATOR) ChangeWindowOwner(old_player, new_player);