changeset 8468:d862bcc2b67b draft

(svn r12038) -Fix: Change ownership of or remove statues when merging/bankrupting companies.
author peter1138 <peter1138@openttd.org>
date Fri, 01 Feb 2008 22:13:59 +0000
parents 284a76aa2868
children 066d7c3ca93d
files src/unmovable_cmd.cpp
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -449,6 +449,19 @@
 
 	if (IsOwnedLand(tile) && new_player != PLAYER_SPECTATOR) {
 		SetTileOwner(tile, new_player);
+	} else if (IsStatueTile(tile)) {
+		TownID town = GetStatueTownID(tile);
+		Town *t = GetTown(town);
+		ClrBit(t->statues, old_player);
+		if (new_player != PLAYER_SPECTATOR && !HasBit(t->statues, new_player)) {
+			/* Transfer ownership to the new company */
+			SetBit(t->statues, new_player);
+			SetTileOwner(tile, new_player);
+		} else {
+			DoClearSquare(tile);
+		}
+
+		InvalidateWindow(WC_TOWN_AUTHORITY, town);
 	} else {
 		DoClearSquare(tile);
 	}