Changeset - r26448:bfdeddc5c3d4
[Not reviewed]
master
0 2 0
Michael Lutz - 23 months ago 2022-10-16 16:01:43
michi@icosahedron.de
Fix db98cedb: Swap the tile parameter validation around as only the first TileIndex is automatically validated.
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -880,7 +880,7 @@ static CommandCost CmdRailTrackHelper(Do
 
	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);
 

	
src/road_cmd.cpp
Show inline comments
 
@@ -976,7 +976,7 @@ static bool CanConnectToRoad(TileIndex t
 
 */
 
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> CmdRemove
 
{
 
	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 */
0 comments (0 inline, 0 general)