forked from mirror/OpenTTD
(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.
This commit is contained in:
@@ -770,6 +770,8 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
|
|||||||
{
|
{
|
||||||
if (!IsTileOwner(tile, old_owner)) return;
|
if (!IsTileOwner(tile, old_owner)) return;
|
||||||
|
|
||||||
|
bool do_clear = false;
|
||||||
|
|
||||||
if (IsObjectType(tile, OBJECT_OWNED_LAND) && new_owner != INVALID_OWNER) {
|
if (IsObjectType(tile, OBJECT_OWNED_LAND) && new_owner != INVALID_OWNER) {
|
||||||
SetTileOwner(tile, new_owner);
|
SetTileOwner(tile, new_owner);
|
||||||
} else if (IsObjectType(tile, OBJECT_STATUE)) {
|
} 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);
|
SetBit(t->statues, new_owner);
|
||||||
SetTileOwner(tile, new_owner);
|
SetTileOwner(tile, new_owner);
|
||||||
} else {
|
} else {
|
||||||
ReallyClearObjectTile(Object::GetByTile(tile));
|
do_clear = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
|
SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
|
||||||
} else {
|
} else {
|
||||||
|
do_clear = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (do_clear) {
|
||||||
ReallyClearObjectTile(Object::GetByTile(tile));
|
ReallyClearObjectTile(Object::GetByTile(tile));
|
||||||
|
/* When clearing objects, they may turn into canal, which may require transfering ownership. */
|
||||||
|
ChangeTileOwner(tile, old_owner, new_owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user