From 28c13ec90fbdc55d27d31652d31a48198b5d2492 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 6 Jan 2021 22:37:57 +0100 Subject: Fix #8168: allow relocating of HQ partial over existing HQ (#8510) Just in case you want to move it SLIGHTLY to the right. --- src/object_cmd.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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)); + } } } -- cgit v1.2.3-54-g00ecf