mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-22 11:44:17 +01:00
Codefix: Clean up object area placement (#15062)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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<CMD_BUILD_OBJECT_AREA>::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
|
||||
|
||||
@@ -308,7 +308,7 @@ std::tuple<CommandCost, Money, TileIndex> 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
|
||||
*/
|
||||
|
||||
@@ -281,7 +281,7 @@ struct TerraformToolbarWindow : Window {
|
||||
if (TileY(end_tile) == Map::MaxY()) end_tile += TileDiffXY(0, -1);
|
||||
}
|
||||
Command<CMD_BUILD_OBJECT_AREA>::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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user