Merge branch 'tracerestrict-sx' into jgrpp

This commit is contained in:
Jonathan G Rennison
2016-03-01 20:55:19 +00:00
5 changed files with 17 additions and 7 deletions

View File

@@ -149,7 +149,7 @@ private:
tile = TILE_ADD(tile, diff);
}
} else if (tile != m_res_fail_tile || td != m_res_fail_td) {
UnreserveRailTrack(tile, TrackdirToTrack(td));
UnreserveRailTrackdir(tile, td);
}
return (tile != m_res_dest || td != m_res_dest_td) && (tile != m_res_fail_tile || td != m_res_fail_td);
}

View File

@@ -154,6 +154,20 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
return false;
}
/**
* Lift the reservation of a specific trackdir on a tile
* This also sets PBS signals to red if unreserving through the facing track direction
* @param tile the tile
* @param t the track
*/
void UnreserveRailTrackdir(TileIndex tile, Trackdir td)
{
if (HasPbsSignalOnTrackdir(tile, td)) {
SetSignalStateByTrackdir(tile, td, SIGNAL_STATE_RED);
}
UnreserveRailTrack(tile, TrackdirToTrack(td));
}
/**
* Lift the reservation of a specific track on a tile
* @param tile the tile

View File

@@ -24,6 +24,7 @@ void SetRailStationPlatformReservation(TileIndex start, DiagDirection dir, bool
bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations = true);
bool TryReserveRailTrackdir(TileIndex tile, Trackdir td, bool trigger_stations = true);
void UnreserveRailTrack(TileIndex tile, Track t);
void UnreserveRailTrackdir(TileIndex tile, Trackdir td);
/** This struct contains information about the end of a reserved path. */
struct PBSTileInfo {

View File

@@ -65,11 +65,6 @@ INSTANTIATE_POOL_METHODS(TraceRestrictProgram)
*/
TraceRestrictMapping _tracerestrictprogram_mapping;
/**
* Default value for pathfinder penalty instructions
*/
static const uint16 _tracerestrict_penalty_item_default_value = 500;
/**
* List of pre-defined pathfinder penalty values
* This is indexed by TraceRestrictPathfinderPenaltyPresetIndex

View File

@@ -2613,7 +2613,7 @@ static PBSTileInfo ExtendTrainReservation(const Train *v, const PBSTileInfo &ori
tile = ft.m_new_tile;
cur_td = FindFirstTrackdir(ft.m_new_td_bits);
UnreserveRailTrack(tile, TrackdirToTrack(cur_td));
UnreserveRailTrackdir(tile, cur_td);
}
/* Path invalid. */