--- a/src/economy.cpp Fri Apr 25 19:27:27 2008 +0000
+++ b/src/economy.cpp Sat Apr 26 20:54:56 2008 +0000
@@ -45,6 +45,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"
@@ -455,6 +456,19 @@
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);