(svn r14348) -Fix (r1667): signs were not updated on company bankrupcy/sell, they have colour of invalid player
authorsmatz
Tue, 16 Sep 2008 20:57:49 +0000
changeset 10158 8f570dcb0997
parent 10157 d5d8510ba53f
child 10159 ed8755ed3810
(svn r14348) -Fix (r1667): signs were not updated on company bankrupcy/sell, they have colour of invalid player
src/economy.cpp
src/openttd.cpp
--- a/src/economy.cpp	Tue Sep 16 19:18:22 2008 +0000
+++ b/src/economy.cpp	Tue Sep 16 20:57:49 2008 +0000
@@ -45,6 +45,7 @@
 #include "gfx_func.h"
 #include "autoreplace_func.h"
 #include "player_gui.h"
+#include "signs_base.h"
 
 #include "table/strings.h"
 #include "table/sprites.h"
@@ -467,6 +468,11 @@
 		}
 	}
 
+	Sign *si;
+	FOR_ALL_SIGNS(si) {
+		if (si->owner == old_player) si->owner = new_player == PLAYER_SPECTATOR ? OWNER_NONE : new_player;
+	}
+
 	/* Change color of existing windows */
 	if (new_player != PLAYER_SPECTATOR) ChangeWindowOwner(old_player, new_player);
 
--- a/src/openttd.cpp	Tue Sep 16 19:18:22 2008 +0000
+++ b/src/openttd.cpp	Tue Sep 16 20:57:49 2008 +0000
@@ -2560,6 +2560,13 @@
 		}
 	}
 
+	if (CheckSavegameVersion(103)) {
+		/* signs with invalid owner left from older savegames */
+		Sign *si;
+		FOR_ALL_SIGNS(si) {
+			if (si->owner != OWNER_NONE && !IsValidPlayerID(si->owner)) si->owner = OWNER_NONE;
+		}
+	}
 
 	GamelogPrintDebug(1);