From b41e23270d5fb4386e44193139d41d5955f866cf Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Thu, 8 Jan 2026 15:51:03 -0500 Subject: [PATCH] Codefix: Clean up object area placement (#15062) --- src/object_cmd.cpp | 2 +- src/object_gui.cpp | 8 +------- src/terraform_cmd.cpp | 2 +- src/terraform_gui.cpp | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 3f390f0970..bfecf1e9ce 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -391,7 +391,7 @@ CommandCost CmdBuildObject(DoCommandFlags flags, TileIndex tile, ObjectType type * @param start_tile start tile of area dragging * @param type the object type to build * @param view the view for the object - * @param diagonal Whether to use the Orthogonal (0) or Diagonal (1) iterator. + * @param diagonal Whether to use the Diagonal or Orthogonal tile iterator. * @return the cost of this operation or an error */ CommandCost CmdBuildObjectArea(DoCommandFlags flags, TileIndex tile, TileIndex start_tile, ObjectType type, uint8_t view, bool diagonal) diff --git a/src/object_gui.cpp b/src/object_gui.cpp index 6aafbc4218..746c5c8f57 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -351,15 +351,9 @@ public: assert(select_proc == DDSP_BUILD_OBJECT); - if (!_settings_game.construction.freeform_edges) { - /* When end_tile is MP_VOID, the error tile will not be visible to the - * user. This happens when terraforming at the southern border. */ - if (TileX(end_tile) == Map::MaxX()) end_tile += TileDiffXY(-1, 0); - if (TileY(end_tile) == Map::MaxY()) end_tile += TileDiffXY(0, -1); - } const ObjectSpec *spec = ObjectClass::Get(_object_gui.sel_class)->GetSpec(_object_gui.sel_type); Command::Post(STR_ERROR_CAN_T_BUILD_OBJECT, CcPlaySound_CONSTRUCTION_OTHER, - end_tile, start_tile, spec->Index(), _object_gui.sel_view, (_ctrl_pressed ? true : false)); + end_tile, start_tile, spec->Index(), _object_gui.sel_view, _ctrl_pressed); } void OnPlaceObjectAbort() override diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp index 8e72366d65..cace1afb4c 100644 --- a/src/terraform_cmd.cpp +++ b/src/terraform_cmd.cpp @@ -308,7 +308,7 @@ std::tuple CmdTerraformLand(DoCommandFlags flags, * @param flags for this command type * @param tile end tile of area-drag * @param start_tile start tile of area drag - * @param diagonal Whether to use the Orthogonal (false) or Diagonal (true) iterator. + * @param diagonal Whether to use the Diagonal or Orthogonal tile iterator. * @param LevelMode Mode of leveling \c LevelMode. * @return the cost of this operation or an error */ diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 92f4df19f6..6bea31b753 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -281,7 +281,7 @@ struct TerraformToolbarWindow : Window { if (TileY(end_tile) == Map::MaxY()) end_tile += TileDiffXY(0, -1); } Command::Post(STR_ERROR_CAN_T_PURCHASE_THIS_LAND, CcPlaySound_CONSTRUCTION_RAIL, - end_tile, start_tile, OBJECT_OWNED_LAND, 0, (_ctrl_pressed ? true : false)); + end_tile, start_tile, OBJECT_OWNED_LAND, 0, _ctrl_pressed); break; } }