From 93b711d70d1b7d499113e7dc9bd2b746652a108a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guilloux?= Date: Sat, 24 Sep 2022 21:56:23 +0200 Subject: [PATCH] Fix #10048: Don't relocate company HQ on the same exact location (#10049) --- src/object_cmd.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index b6ea0b4084..dad4039461 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -328,6 +328,8 @@ CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, ObjectType type, case OBJECT_HQ: { Company *c = Company::Get(_current_company); if (c->location_of_HQ != INVALID_TILE) { + /* Don't relocate HQ on the same location. */ + if (c->location_of_HQ == tile) return_cmd_error(STR_ERROR_ALREADY_BUILT); /* We need to persuade a bit harder to remove the old HQ. */ _current_company = OWNER_WATER; cost.AddCost(ClearTile_Object(c->location_of_HQ, flags));