summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-09-18 14:07:52 +0000
committerfrosch <frosch@openttd.org>2016-09-18 14:07:52 +0000
commitd7ee0b6fee3008f9a891f185395d6dc90c71e7c7 (patch)
tree0673d57a93b0f9ab25cff74c788a915a0a60c47f
parent5385104ed6e21ee6f2fb7c51d1c9bd80b80f1414 (diff)
downloadopenttd-d7ee0b6fee3008f9a891f185395d6dc90c71e7c7.tar.xz
(svn r27656) -Fix [FS#6511]: When removing objects of bankrupt companies the tiles may revert to canal. In that case also check the ownership of the canal.
-rw-r--r--src/object_cmd.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index b5b992152..f7ba0d995 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -770,6 +770,8 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
{
if (!IsTileOwner(tile, old_owner)) return;
+ bool do_clear = false;
+
if (IsObjectType(tile, OBJECT_OWNED_LAND) && new_owner != INVALID_OWNER) {
SetTileOwner(tile, new_owner);
} else if (IsObjectType(tile, OBJECT_STATUE)) {
@@ -780,12 +782,18 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
SetBit(t->statues, new_owner);
SetTileOwner(tile, new_owner);
} else {
- ReallyClearObjectTile(Object::GetByTile(tile));
+ do_clear = true;
}
SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
} else {
+ do_clear = true;
+ }
+
+ if (do_clear) {
ReallyClearObjectTile(Object::GetByTile(tile));
+ /* When clearing objects, they may turn into canal, which may require transfering ownership. */
+ ChangeTileOwner(tile, old_owner, new_owner);
}
}