mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-22 14:09:10 +00:00
(svn r19654) -Codechange: Use Extract<> in more places.
This commit is contained in:
@@ -469,10 +469,10 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
/* do not allow building 'zero' road bits, code wouldn't handle it */
|
||||
if (pieces == ROAD_NONE) return CMD_ERROR;
|
||||
|
||||
RoadType rt = (RoadType)GB(p1, 4, 2);
|
||||
RoadType rt = Extract<RoadType, 4, 2>(p1);
|
||||
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
|
||||
|
||||
DisallowedRoadDirections toggle_drd = (DisallowedRoadDirections)GB(p1, 6, 2);
|
||||
DisallowedRoadDirections toggle_drd = Extract<DisallowedRoadDirections, 6, 2>(p1);
|
||||
|
||||
Slope tileh = GetTileSlope(tile, NULL);
|
||||
|
||||
@@ -726,7 +726,7 @@ CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p
|
||||
if (p1 >= MapSize()) return CMD_ERROR;
|
||||
|
||||
TileIndex end_tile = p1;
|
||||
RoadType rt = (RoadType)GB(p2, 3, 2);
|
||||
RoadType rt = Extract<RoadType, 3, 2>(p2);
|
||||
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
|
||||
|
||||
Axis axis = Extract<Axis, 2, 1>(p2);
|
||||
@@ -818,7 +818,7 @@ CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32
|
||||
if (p1 >= MapSize()) return CMD_ERROR;
|
||||
|
||||
TileIndex end_tile = p1;
|
||||
RoadType rt = (RoadType)GB(p2, 3, 2);
|
||||
RoadType rt = Extract<RoadType, 3, 2>(p2);
|
||||
if (!IsValidRoadType(rt)) return CMD_ERROR;
|
||||
|
||||
Axis axis = Extract<Axis, 2, 1>(p2);
|
||||
@@ -887,7 +887,7 @@ CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32
|
||||
CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
DiagDirection dir = Extract<DiagDirection, 0, 2>(p1);
|
||||
RoadType rt = (RoadType)GB(p1, 2, 2);
|
||||
RoadType rt = Extract<RoadType, 2, 2>(p1);
|
||||
|
||||
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
|
||||
|
||||
|
Reference in New Issue
Block a user