From 7ae255a553aa6c970bc2b68abbe395c42638aaca Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 16 Sep 2008 20:57:49 +0000 Subject: [PATCH] (svn r14348) -Fix (r1667): signs were not updated on company bankrupcy/sell, they have colour of invalid player --- src/economy.cpp | 6 ++++++ src/openttd.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/economy.cpp b/src/economy.cpp index a80ea602d7..8629fc270b 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -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 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player) } } + 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); diff --git a/src/openttd.cpp b/src/openttd.cpp index 23c2b81ce2..1b690e2a2c 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2560,6 +2560,13 @@ bool AfterLoadGame() } } + 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);