1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-27 08:29:11 +00:00

Fix #10048: Don't relocate company HQ on the same exact location (#10049)

This commit is contained in:
Loïc Guilloux
2022-09-24 21:56:23 +02:00
committed by GitHub
parent 70d33dc71f
commit 93b711d70d

View File

@@ -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));