diff options
author | Patric Stout <truebrain@openttd.org> | 2021-01-06 22:37:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-06 22:37:57 +0100 |
commit | 28c13ec90fbdc55d27d31652d31a48198b5d2492 (patch) | |
tree | 7cf25f74e7fc4a70e712ff758756cb004336bcec /src/object_cmd.cpp | |
parent | a4e34e824c481a7d3390c2739146192ac827533e (diff) | |
download | openttd-28c13ec90fbdc55d27d31652d31a48198b5d2492.tar.xz |
Fix #8168: allow relocating of HQ partial over existing HQ (#8510)
Just in case you want to move it SLIGHTLY to the right.
Diffstat (limited to 'src/object_cmd.cpp')
-rw-r--r-- | src/object_cmd.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 3fb61d647..479f3b0d1 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -248,7 +248,14 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 } else { if (!allow_ground) return_cmd_error(STR_ERROR_MUST_BE_BUILT_ON_WATER); /* For non-water tiles, we'll have to clear it before building. */ - cost.AddCost(DoCommand(t, 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR)); + + /* When relocating HQ, allow it to be relocated (partial) on itself. */ + if (!(type == OBJECT_HQ && + IsTileType(t, MP_OBJECT) && + IsTileOwner(t, _current_company) && + IsObjectType(t, OBJECT_HQ))) { + cost.AddCost(DoCommand(t, 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR)); + } } } |