Fix water infrastructure total when changing owner of object on water
This commit is contained in:
@@ -1173,6 +1173,10 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
|
|||||||
ObjectType type = GetObjectType(tile);
|
ObjectType type = GetObjectType(tile);
|
||||||
if ((type == OBJECT_OWNED_LAND || type >= NEW_OBJECT_OFFSET) && new_owner != INVALID_OWNER) {
|
if ((type == OBJECT_OWNED_LAND || type >= NEW_OBJECT_OFFSET) && new_owner != INVALID_OWNER) {
|
||||||
SetTileOwner(tile, new_owner);
|
SetTileOwner(tile, new_owner);
|
||||||
|
if (GetWaterClass(tile) == WATER_CLASS_CANAL) {
|
||||||
|
Company::Get(old_owner)->infrastructure.water--;
|
||||||
|
Company::Get(new_owner)->infrastructure.water++;
|
||||||
|
}
|
||||||
} else if (type == OBJECT_STATUE) {
|
} else if (type == OBJECT_STATUE) {
|
||||||
Town *t = Object::GetByTile(tile)->town;
|
Town *t = Object::GetByTile(tile)->town;
|
||||||
ClrBit(t->statues, old_owner);
|
ClrBit(t->statues, old_owner);
|
||||||
|
Reference in New Issue
Block a user