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

sse-blitter-set-alpha
Loïc Guilloux 2 years ago committed by GitHub
parent 70d33dc71f
commit 93b711d70d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save