Merge branch 'master' into jgrpp

# Conflicts:
#	docs/landscape.html
#	docs/landscape_grid.html
#	src/bridge_gui.cpp
#	src/bridge_map.h
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/rail_map.h
#	src/rail_type.h
#	src/road_map.h
#	src/saveload/afterload.cpp
#	src/saveload/map_sl.cpp
#	src/saveload/saveload.cpp
#	src/script/api/script_rail.cpp
#	src/station_cmd.cpp
#	src/tunnel_map.h
#	src/tunnelbridge_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2018-07-26 20:54:13 +01:00
21 changed files with 241 additions and 135 deletions

View File

@@ -165,11 +165,11 @@ RailType AllocateRailType(RailTypeLabel label)
rti->alternate_labels.Clear();
/* Make us compatible with ourself. */
rti->powered_railtypes = (RailTypes)(1 << rt);
rti->compatible_railtypes = (RailTypes)(1 << rt);
rti->powered_railtypes = (RailTypes)(1LL << rt);
rti->compatible_railtypes = (RailTypes)(1LL << rt);
/* We also introduce ourself. */
rti->introduces_railtypes = (RailTypes)(1 << rt);
rti->introduces_railtypes = (RailTypes)(1LL << rt);
/* Default sort order; order of allocation, but with some
* offsets so it's easier for NewGRF to pick a spot without
@@ -459,7 +459,7 @@ static inline bool ValParamTrackOrientation(Track track)
*/
CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
RailType railtype = Extract<RailType, 0, 5>(p1);
RailType railtype = Extract<RailType, 0, 6>(p1);
Track track = Extract<Track, 0, 3>(p2);
bool disable_custom_bridge_heads = HasBit(p2, 4);
CommandCost cost(EXPENSES_CONSTRUCTION);
@@ -968,20 +968,20 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
* @param flags operation to perform
* @param p1 end tile of drag
* @param p2 various bitstuffed elements
* - p2 = (bit 0-4) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
* - p2 = (bit 5-7) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 8) - 0 = build, 1 = remove tracks
* - p2 = (bit 9) - 0 = build up to an obstacle, 1 = fail if an obstacle is found (used for AIs).
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
* - p2 = (bit 6-8) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 9) - 0 = build, 1 = remove tracks
* - p2 = (bit 10) - 0 = build up to an obstacle, 1 = fail if an obstacle is found (used for AIs).
* @param text unused
* @return the cost of this operation or an error
*/
static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost total_cost(EXPENSES_CONSTRUCTION);
RailType railtype = Extract<RailType, 0, 5>(p2);
Track track = Extract<Track, 5, 3>(p2);
bool remove = HasBit(p2, 8);
bool fail_if_obstacle = HasBit(p2, 9);
RailType railtype = Extract<RailType, 0, 6>(p2);
Track track = Extract<Track, 6, 3>(p2);
bool remove = HasBit(p2, 9);
bool fail_if_obstacle = HasBit(p2, 10);
_rail_track_endtile = INVALID_TILE;
@@ -1033,16 +1033,16 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint3
* @param flags operation to perform
* @param p1 end tile of drag
* @param p2 various bitstuffed elements
* - p2 = (bit 0-4) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev)
* - p2 = (bit 5-7) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 8) - 0 = build, 1 = remove tracks
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev)
* - p2 = (bit 6-8) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 9) - 0 = build, 1 = remove tracks
* @param text unused
* @return the cost of this operation or an error
* @see CmdRailTrackHelper
*/
CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdRailTrackHelper(tile, flags, p1, ClrBit(p2, 8), text);
return CmdRailTrackHelper(tile, flags, p1, ClrBit(p2, 9), text);
}
/**
@@ -1052,16 +1052,16 @@ CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1
* @param flags operation to perform
* @param p1 end tile of drag
* @param p2 various bitstuffed elements
* - p2 = (bit 0-4) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
* - p2 = (bit 5-7) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 8) - 0 = build, 1 = remove tracks
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
* - p2 = (bit 6-8) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 9) - 0 = build, 1 = remove tracks
* @param text unused
* @return the cost of this operation or an error
* @see CmdRailTrackHelper
*/
CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdRailTrackHelper(tile, flags, p1, SetBit(p2, 8), text);
return CmdRailTrackHelper(tile, flags, p1, SetBit(p2, 9), text);
}
/**
@@ -1079,7 +1079,7 @@ CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p
CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* check railtype and valid direction for depot (0 through 3), 4 in total */
RailType railtype = Extract<RailType, 0, 5>(p1);
RailType railtype = Extract<RailType, 0, 6>(p1);
if (!ValParamRailtype(railtype)) return CMD_ERROR;
Slope tileh = GetTileSlope(tile);
@@ -1876,17 +1876,17 @@ static Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
* @param flags operation to perform
* @param p1 start tile of drag
* @param p2 various bitstuffed elements:
* - p2 = (bit 0 - 4) new railtype to convert to.
* - p2 = (bit 5) build diagonally or not.
* - p2 = (bit 0- 5) new railtype to convert to.
* - p2 = (bit 6) build diagonally or not.
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
RailType totype = Extract<RailType, 0, 5>(p2);
RailType totype = Extract<RailType, 0, 6>(p2);
TileIndex area_start = p1;
TileIndex area_end = tile;
bool diagonal = HasBit(p2, 5);
bool diagonal = HasBit(p2, 6);
if (!ValParamRailtype(totype)) return CMD_ERROR;
if (area_start >= MapSize()) return CMD_ERROR;