summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-04-08 19:20:43 +0100
committerGitHub <noreply@github.com>2019-04-08 19:20:43 +0100
commit812886ca618b39b36e85f23e5056398e26123645 (patch)
tree96f41a1dcb7910ebcdc4cae9c16ee73967e14ad8 /src
parentbc9b47d2e56808b9e74b016fa1e544b4f2d4e1b5 (diff)
downloadopenttd-812886ca618b39b36e85f23e5056398e26123645.tar.xz
Fix #7478: Don't remove NewGRF objects on company take-over. (#7483)
Diffstat (limited to 'src')
-rw-r--r--src/object_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 92e6d6ab2..a57aa57f0 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -768,9 +768,10 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
bool do_clear = false;
- if (IsObjectType(tile, OBJECT_OWNED_LAND) && new_owner != INVALID_OWNER) {
+ ObjectType type = GetObjectType(tile);
+ if ((type == OBJECT_OWNED_LAND || type >= NEW_OBJECT_OFFSET) && new_owner != INVALID_OWNER) {
SetTileOwner(tile, new_owner);
- } else if (IsObjectType(tile, OBJECT_STATUE)) {
+ } else if (type == OBJECT_STATUE) {
Town *t = Object::GetByTile(tile)->town;
ClrBit(t->statues, old_owner);
if (new_owner != INVALID_OWNER && !HasBit(t->statues, new_owner)) {