mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-07 23:10:04 +00:00
Fix db98cedb
: Swap the tile parameter validation around as only the first TileIndex is automatically validated.
This commit is contained in:
parent
10daaca5ea
commit
8e6ed8d5e9
@ -880,7 +880,7 @@ static CommandCost CmdRailTrackHelper(DoCommandFlag flags, TileIndex tile, TileI
|
||||
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
||||
|
||||
if ((!remove && !ValParamRailtype(railtype)) || !ValParamTrackOrientation(track)) return CMD_ERROR;
|
||||
if (end_tile >= MapSize()) return CMD_ERROR;
|
||||
if (end_tile >= MapSize() || tile >= MapSize()) return CMD_ERROR;
|
||||
|
||||
Trackdir trackdir = TrackToTrackdir(track);
|
||||
|
||||
|
@ -976,7 +976,7 @@ static bool CanConnectToRoad(TileIndex tile, RoadType rt, DiagDirection dir)
|
||||
*/
|
||||
CommandCost CmdBuildLongRoad(DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai)
|
||||
{
|
||||
if (end_tile >= MapSize()) return CMD_ERROR;
|
||||
if (start_tile >= MapSize()) return CMD_ERROR;
|
||||
|
||||
if (!ValParamRoadType(rt) || !IsValidAxis(axis) || !IsValidDisallowedRoadDirections(drd)) return CMD_ERROR;
|
||||
|
||||
@ -1074,7 +1074,7 @@ std::tuple<CommandCost, Money> CmdRemoveLongRoad(DoCommandFlag flags, TileIndex
|
||||
{
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||
|
||||
if (end_tile >= MapSize()) return { CMD_ERROR, 0 };
|
||||
if (start_tile >= MapSize()) return { CMD_ERROR, 0 };
|
||||
if (!ValParamRoadType(rt) || !IsValidAxis(axis)) return { CMD_ERROR, 0 };
|
||||
|
||||
/* Only drag in X or Y direction dictated by the direction variable */
|
||||
|
Loading…
Reference in New Issue
Block a user