mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Check for tracerestrict wait/wait at start in signal propagation
When using realistic braking, block/auto signals now don't default to green on plain line where this would conflict with wait at PBS or wait at start PBS tracerestrict actions.
This commit is contained in:
parent
130a8e28dc
commit
e42ac911ff
@ -463,6 +463,8 @@
|
||||
</tr>
|
||||
</table>
|
||||
<ul>
|
||||
<li style="color: blue">m1 bit 6: special signal propagation flag set for signal 0 or 1</li>
|
||||
<li style="color: blue">m1 bit 5: special signal propagation flag set for signal 2 or 3</li>
|
||||
<li>m2 bit 7: Signal 0 and 1: set = semaphore signals, clear = light signals</li>
|
||||
<li>m2 bit 3: Signal 2 and 3: set = semaphore signals, clear = light signals</li>
|
||||
<li>m2 bits 6..4: type of signal 0 and 1 (same values as m2 bits 2..0)</li>
|
||||
@ -1756,6 +1758,7 @@
|
||||
</table>
|
||||
If signal simulation entrance or exit:
|
||||
<ul>
|
||||
<li>m1 bit 5: special signal propagation flag set</li>
|
||||
<li>m2 bit 15: for bridge entrances only: storage for visual red/green state of signals starting from 15 is allocated outside the map array</li>
|
||||
<li>m2 bits 14..4: for bridge entrances only: for signals 0..10 on bridge, signal is visually red if corresponding bit in 4..14 is set</li>
|
||||
<li>m3 bit 7: the signal style is non-zero (style stored outside the map array)</li>
|
||||
|
@ -98,7 +98,7 @@ the array so you can quickly see what is used and what is not.
|
||||
<tr>
|
||||
<td rowspan=3>1</td>
|
||||
<td class="caption">rail</td>
|
||||
<td class="bits" rowspan=3><span class="used" title="Ship docking tile status (for half-tile with water)">X</span><span class="free">OO</span><span class="used" title="Owner">X XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Ship docking tile status (for half-tile with water)">X</span><span class="free">OO</span><span class="used" title="Owner">X XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Reserved tracks">XXXX</span> <span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span> </td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Ground type: fences, snow, desert">XXXX</span></td>
|
||||
@ -109,6 +109,7 @@ the array so you can quickly see what is used and what is not.
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">rail with signals</td>
|
||||
<td class="bits"><span class="used" title="Ship docking tile status (for half-tile with water)">X</span><span class="patch" title="Special signal propagation flags">PP</span><span class="used" title="Owner">X XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="patch" title="1 or more routing restrictions present">P</span> <span class="used" title="Reserved tracks">XXXX</span> <span class="used" title="Signal types and sempahore/lights">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Signals present">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="used" title="Signals colors">XXXX</span> <span class="used" title="Ground type: fences, snow, desert">XXXX</span></td>
|
||||
@ -118,6 +119,7 @@ the array so you can quickly see what is used and what is not.
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">depot</td>
|
||||
<td class="bits"><span class="used" title="Ship docking tile status (for half-tile with water)">X</span><span class="free">OO</span><span class="used" title="Owner">X XXXX</span></td>
|
||||
<td class="bits"><span class="pool" title="Depot index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Ground type: fences, snow, desert (fences on depot are not valid)">XXXX</span></td>
|
||||
@ -292,7 +294,7 @@ the array so you can quickly see what is used and what is not.
|
||||
<tr>
|
||||
<td rowspan=4>9</td>
|
||||
<td class="caption">tunnel entrance</td>
|
||||
<td class="bits" rowspan=3><span class="free">OOO</span> <span class="used" title="Owner">XXXXX</span></td>
|
||||
<td class="bits" rowspan=3><span class="free">OO</span><span class="patch" title="special signal propagation flag (rail only)">P</span> <span class="used" title="Owner">XXXXX</span></td>
|
||||
<td class="bits"><span class="patch-pool" title="Tunnel index on pool (or overflow sentinel)">PPPP PPPP PPPP PPPP</span></td>
|
||||
<td class="bits" rowspan=4><span class="rearrange" title="Owner of tram (road only; a rearrangement can free some of these bits)">XXXX</span> <span class="free">OOOO</span><br /><span class="patch" title="New signal style is non-zero (rail only)">P</span> <span class="patch" title="Routing restrictions present on entrance/exit signal(s)">P</span> <span class="patch" title="Entrance/exit signal aspects (rail only)">PPPPPP</span></td>
|
||||
<td class="bits"><span class="free">OO</span><span class="used" title="Road type">XX XXXX</span></td>
|
||||
|
@ -1444,6 +1444,8 @@ static void ClearBridgeTunnelSignalSimulation(TileIndex entrance, TileIndex exit
|
||||
if (IsBridge(entrance)) ClearBridgeEntranceSimulatedSignals(entrance);
|
||||
ClrTunnelBridgeSignalSimulationEntrance(entrance);
|
||||
ClrTunnelBridgeSignalSimulationExit(exit);
|
||||
SetTunnelBridgeSignalSpecialPropagationFlag(entrance, false);
|
||||
SetTunnelBridgeSignalSpecialPropagationFlag(exit, false);
|
||||
}
|
||||
|
||||
static void SetupBridgeTunnelSignalSimulation(TileIndex entrance, TileIndex exit)
|
||||
@ -1451,6 +1453,8 @@ static void SetupBridgeTunnelSignalSimulation(TileIndex entrance, TileIndex exit
|
||||
SetTunnelBridgeSignalSimulationEntrance(entrance);
|
||||
SetTunnelBridgeEntranceSignalState(entrance, SIGNAL_STATE_GREEN);
|
||||
SetTunnelBridgeSignalSimulationExit(exit);
|
||||
UpdateTunnelBridgeSignalSpecialPropagationFlag(entrance, false);
|
||||
UpdateTunnelBridgeSignalSpecialPropagationFlag(exit, false);
|
||||
if (_extra_aspects > 0) {
|
||||
SetTunnelBridgeEntranceSignalAspect(entrance, 0);
|
||||
UpdateAspectDeferred(entrance, GetTunnelBridgeEntranceTrackdir(entrance));
|
||||
@ -1791,6 +1795,7 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32_t p
|
||||
SetSignalVariant(tile, track, sigvar);
|
||||
SetSignalStyle(tile, track, signal_style);
|
||||
UpdateSignalReserveThroughBit(tile, track, false);
|
||||
SetSignalSpecialPropagationFlag(tile, track, false);
|
||||
}
|
||||
|
||||
/* Subtract old signal infrastructure count. */
|
||||
@ -1804,6 +1809,7 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32_t p
|
||||
SetSignalVariant(tile, track, sigvar);
|
||||
SetSignalStyle(tile, track, signal_style);
|
||||
UpdateSignalReserveThroughBit(tile, track, false);
|
||||
SetSignalSpecialPropagationFlag(tile, track, false);
|
||||
while (num_dir_cycle-- > 0) CycleSignalSide(tile, track);
|
||||
} else {
|
||||
if (convert_signal) {
|
||||
@ -1830,6 +1836,7 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32_t p
|
||||
if (sigtype == SIGTYPE_NO_ENTRY) CycleSignalSide(tile, track);
|
||||
|
||||
UpdateSignalReserveThroughBit(tile, track, false);
|
||||
UpdateRailSignalSpecialPropagationFlag(tile, track, GetExistingTraceRestrictProgram(tile, track), false);
|
||||
}
|
||||
|
||||
} else if (ctrl_pressed) {
|
||||
@ -1864,11 +1871,13 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32_t p
|
||||
* direction of the first signal given as parameter by CmdBuildManySignals */
|
||||
SetPresentSignals(tile, (GetPresentSignals(tile) & ~SignalOnTrack(track)) | (p2 & SignalOnTrack(track)));
|
||||
SetSignalVariant(tile, track, sigvar);
|
||||
if (IsPresignalProgrammable(tile, track))
|
||||
if (IsPresignalProgrammable(tile, track)) {
|
||||
FreeSignalProgram(SignalReference(tile, track));
|
||||
}
|
||||
SetSignalType(tile, track, sigtype);
|
||||
SetSignalStyle(tile, track, signal_style);
|
||||
UpdateSignalReserveThroughBit(tile, track, false);
|
||||
UpdateRailSignalSpecialPropagationFlag(tile, track, GetExistingTraceRestrictProgram(tile, track), false);
|
||||
}
|
||||
|
||||
/* Add new signal infrastructure count. */
|
||||
|
@ -442,6 +442,20 @@ inline void SetSignalAlwaysReserveThrough(TileIndex t, Track track, bool reserve
|
||||
SB(_me[t].m7, pos, 1, reserve_through ? 1 : 0);
|
||||
}
|
||||
|
||||
inline bool GetSignalSpecialPropagationFlag(TileIndex t, Track track)
|
||||
{
|
||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||
uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 6 : 5;
|
||||
return HasBit(_m[t].m1, pos);
|
||||
}
|
||||
|
||||
inline void SetSignalSpecialPropagationFlag(TileIndex t, Track track, bool special)
|
||||
{
|
||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||
uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 6 : 5;
|
||||
SB(_m[t].m1, pos, 1, special ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the states of the signals (Along/AgainstTrackDir)
|
||||
* @param tile the tile to set the states for
|
||||
|
@ -4492,6 +4492,10 @@ bool AfterLoadGame()
|
||||
bool update_always_reserve_through = SlXvIsFeaturePresent(XSLFI_REALISTIC_TRAIN_BRAKING, 8, 10);
|
||||
UpdateExtraAspectsVariable(update_always_reserve_through);
|
||||
|
||||
if (SlXvIsFeatureMissing(XSLFI_SIGNAL_SPECIAL_PROPAGATION_FLAG)) {
|
||||
UpdateAllSignalsSpecialPropagationFlag();
|
||||
}
|
||||
|
||||
UpdateCargoScalers();
|
||||
|
||||
if (_networking && !_network_server) {
|
||||
|
106
src/signal.cpp
106
src/signal.cpp
@ -416,6 +416,13 @@ static SigInfo ExploreSegment(Owner owner)
|
||||
info.flags |= SF_PBS;
|
||||
}
|
||||
}
|
||||
if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC && GetSignalSpecialPropagationFlag(tile, track)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, track);
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_PBS_RES_END_WAIT) {
|
||||
/* Reservations ending here could be forced to wait, so treat signals blocks leading up to this signal as PBS */
|
||||
info.flags |= SF_PBS;
|
||||
}
|
||||
}
|
||||
|
||||
/* if it is a presignal EXIT in OUR direction, count it */
|
||||
if (IsExitSignal(sig)) { // found presignal exit
|
||||
@ -492,6 +499,20 @@ static SigInfo ExploreSegment(Owner owner)
|
||||
if (tracks == TRACK_BIT_HORZ || tracks == TRACK_BIT_VERT) tracks = tracks_masked;
|
||||
|
||||
if (IsTunnelBridgeWithSignalSimulation(tile)) {
|
||||
auto handle_entrance = [&]() {
|
||||
if (_extra_aspects > 0) {
|
||||
info.out_signal_tile = tile;
|
||||
info.out_signal_trackdir = GetTunnelBridgeEntranceTrackdir(tile, tunnel_bridge_dir);
|
||||
}
|
||||
if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC && GetTunnelBridgeSignalSpecialPropagationFlag(tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, FindFirstTrack(GetAcrossTunnelBridgeTrackBits(tile)));
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_PBS_RES_END_WAIT) {
|
||||
/* Reservations ending here could be forced to wait, so treat signals blocks leading up to this signal as PBS */
|
||||
info.flags |= SF_PBS;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (enterdir == INVALID_DIAGDIR) {
|
||||
// incoming from the wormhole, onto signal
|
||||
if (!(info.flags & SF_TRAIN) && IsTunnelBridgeSignalSimulationExit(tile)) { // tunnel entrance is ignored
|
||||
@ -502,10 +523,7 @@ static SigInfo ExploreSegment(Owner owner)
|
||||
info.flags |= SF_FULL;
|
||||
return info;
|
||||
}
|
||||
if (_extra_aspects > 0 && IsTunnelBridgeSignalSimulationEntrance(tile)) {
|
||||
info.out_signal_tile = tile;
|
||||
info.out_signal_trackdir = GetTunnelBridgeEntranceTrackdir(tile, tunnel_bridge_dir);
|
||||
}
|
||||
if (IsTunnelBridgeSignalSimulationEntrance(tile)) handle_entrance();
|
||||
Trackdir exit_track = GetTunnelBridgeExitTrackdir(tile, tunnel_bridge_dir);
|
||||
exitdir = TrackdirToExitdir(exit_track);
|
||||
enterdir = ReverseDiagDir(exitdir);
|
||||
@ -525,10 +543,7 @@ static SigInfo ExploreSegment(Owner owner)
|
||||
return info;
|
||||
}
|
||||
}
|
||||
if (_extra_aspects > 0 && IsTunnelBridgeSignalSimulationEntrance(tile)) {
|
||||
info.out_signal_tile = tile;
|
||||
info.out_signal_trackdir = GetTunnelBridgeEntranceTrackdir(tile, tunnel_bridge_dir);
|
||||
}
|
||||
if (IsTunnelBridgeSignalSimulationEntrance(tile)) handle_entrance();
|
||||
if (!(info.flags & SF_TRAIN)) {
|
||||
if (HasVehicleOnPos(tile, VEH_TRAIN, reinterpret_cast<void *>((uintptr_t)tile), &TrainInWormholeTileEnum)) info.flags |= SF_TRAIN;
|
||||
if (!(info.flags & SF_TRAIN) && IsTunnelBridgeSignalSimulationExit(tile)) {
|
||||
@ -785,6 +800,13 @@ static void UpdateSignalsAroundSegment(SigInfo info)
|
||||
}
|
||||
SignalState old_state = GetTunnelBridgeExitSignalState(tile);
|
||||
SignalState new_state = (info.flags & SF_TRAIN) ? SIGNAL_STATE_RED : SIGNAL_STATE_GREEN;
|
||||
if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC && new_state == SIGNAL_STATE_GREEN && GetTunnelBridgeSignalSpecialPropagationFlag(tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, FindFirstTrack(GetAcrossTunnelBridgeTrackBits(tile)));
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_WAIT_AT_PBS) {
|
||||
/* Reservations starting here could be forced to wait, so default to red */
|
||||
new_state = SIGNAL_STATE_RED;
|
||||
}
|
||||
}
|
||||
bool refresh = false;
|
||||
if (old_state != new_state) {
|
||||
SetTunnelBridgeExitSignalState(tile, new_state);
|
||||
@ -867,6 +889,13 @@ static void UpdateSignalsAroundSegment(SigInfo info)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC && newstate == SIGNAL_STATE_GREEN && GetSignalSpecialPropagationFlag(tile, track)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, track);
|
||||
if (prog != nullptr && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_REVERSE_AT)) {
|
||||
/* Reservations starting here could be forced to wait, so default to red */
|
||||
newstate = SIGNAL_STATE_RED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool refresh = false;
|
||||
@ -2006,3 +2035,64 @@ void UpdateAllSignalReserveThroughBits()
|
||||
}
|
||||
} while (++tile != MapSize());
|
||||
}
|
||||
|
||||
void UpdateSignalSpecialPropagationFlag(TileIndex tile, Track track, const struct TraceRestrictProgram *prog, bool update_signal)
|
||||
{
|
||||
if (IsTileType(tile, MP_RAILWAY)) {
|
||||
UpdateRailSignalSpecialPropagationFlag(tile, track, prog, update_signal);
|
||||
} else {
|
||||
UpdateTunnelBridgeSignalSpecialPropagationFlag(tile, track, prog, update_signal);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateRailSignalSpecialPropagationFlag(TileIndex tile, Track track, const TraceRestrictProgram *prog, bool update_signal)
|
||||
{
|
||||
bool is_special = (prog != nullptr && prog->actions_used_flags & TRPAUF_SPECIAL_ASPECT_PROPAGATION_FLAG_MASK);
|
||||
|
||||
if (is_special || GetSignalSpecialPropagationFlag(tile, track)) {
|
||||
SetSignalSpecialPropagationFlag(tile, track, is_special);
|
||||
if (update_signal && _settings_game.vehicle.train_braking_model == TBM_REALISTIC) {
|
||||
AddTrackToSignalBuffer(tile, track, GetTileOwner(tile));
|
||||
UpdateSignalsInBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateTunnelBridgeSignalSpecialPropagationFlag(TileIndex tile, bool update_signal)
|
||||
{
|
||||
if (!IsTunnelBridgeRestrictedSignal(tile) && !GetTunnelBridgeSignalSpecialPropagationFlag(tile)) return;
|
||||
|
||||
Track track = FindFirstTrack(GetAcrossTunnelBridgeTrackBits(tile));
|
||||
UpdateTunnelBridgeSignalSpecialPropagationFlag(tile, track, GetExistingTraceRestrictProgram(tile, track), false);
|
||||
}
|
||||
|
||||
void UpdateTunnelBridgeSignalSpecialPropagationFlag(TileIndex tile, Track track, const TraceRestrictProgram *prog, bool update_signal)
|
||||
{
|
||||
bool is_special = (prog != nullptr && prog->actions_used_flags & TRPAUF_SPECIAL_ASPECT_PROPAGATION_FLAG_MASK);
|
||||
|
||||
if (is_special || GetTunnelBridgeSignalSpecialPropagationFlag(tile)) {
|
||||
SetTunnelBridgeSignalSpecialPropagationFlag(tile, is_special);
|
||||
if (update_signal && _settings_game.vehicle.train_braking_model == TBM_REALISTIC) {
|
||||
AddTrackToSignalBuffer(tile, track, GetTileOwner(tile));
|
||||
UpdateSignalsInBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAllSignalsSpecialPropagationFlag()
|
||||
{
|
||||
TileIndex tile = 0;
|
||||
do {
|
||||
if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile)) {
|
||||
TrackBits bits = GetTrackBits(tile);
|
||||
do {
|
||||
Track track = RemoveFirstTrack(&bits);
|
||||
if (HasSignalOnTrack(tile, track)) {
|
||||
UpdateRailSignalSpecialPropagationFlag(tile, track, GetExistingTraceRestrictProgram(tile, track), false);
|
||||
}
|
||||
} while (bits != TRACK_BIT_NONE);
|
||||
} else if (IsTunnelBridgeWithSignalSimulation(tile)) {
|
||||
UpdateTunnelBridgeSignalSpecialPropagationFlag(tile, false);
|
||||
}
|
||||
} while (++tile != MapSize());
|
||||
}
|
||||
|
@ -202,5 +202,10 @@ inline uint8_t GetForwardAspectFollowingTrackAndIncrement(TileIndex tile, Trackd
|
||||
|
||||
void UpdateSignalReserveThroughBit(TileIndex tile, Track track, bool update_signal);
|
||||
void UpdateAllSignalReserveThroughBits();
|
||||
void UpdateSignalSpecialPropagationFlag(TileIndex tile, Track track, const struct TraceRestrictProgram *prog, bool update_signal);
|
||||
void UpdateRailSignalSpecialPropagationFlag(TileIndex tile, Track track, const struct TraceRestrictProgram *prog, bool update_signal);
|
||||
void UpdateTunnelBridgeSignalSpecialPropagationFlag(TileIndex tile, bool update_signal);
|
||||
void UpdateTunnelBridgeSignalSpecialPropagationFlag(TileIndex tile, Track track, const TraceRestrictProgram *prog, bool update_signal);
|
||||
void UpdateAllSignalsSpecialPropagationFlag();
|
||||
|
||||
#endif /* SIGNAL_FUNC_H */
|
||||
|
@ -194,6 +194,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_ROAD_VEH_FLAGS, XSCF_NULL, 1, 1, "road_veh_flags", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_STATION_TILE_CACHE_FLAGS, XSCF_IGNORABLE_ALL, 1, 1, "station_tile_cache_flags", saveSTC, loadSTC, nullptr },
|
||||
{ XSLFI_INDUSTRY_CARGO_TOTALS, XSCF_NULL, 1, 1, "industry_cargo_totals", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_SIGNAL_SPECIAL_PROPAGATION_FLAG, XSCF_IGNORABLE_ALL, 1, 1, "signal_special_propagation_flag", nullptr, nullptr, nullptr },
|
||||
|
||||
{ XSLFI_SCRIPT_INT64, XSCF_NULL, 1, 1, "script_int64", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_U64_TICK_COUNTER, XSCF_NULL, 1, 1, "u64_tick_counter", nullptr, nullptr, nullptr },
|
||||
|
@ -143,6 +143,7 @@ enum SlXvFeatureIndex {
|
||||
XSLFI_ROAD_VEH_FLAGS, ///< Road vehicle flags
|
||||
XSLFI_STATION_TILE_CACHE_FLAGS, ///< Station tile cache flags
|
||||
XSLFI_INDUSTRY_CARGO_TOTALS, ///< Industry cargo totals are 32 bit
|
||||
XSLFI_SIGNAL_SPECIAL_PROPAGATION_FLAG, ///< Signal special propagation flag
|
||||
|
||||
XSLFI_SCRIPT_INT64, ///< See: SLV_SCRIPT_INT64
|
||||
XSLFI_U64_TICK_COUNTER, ///< See: SLV_U64_TICK_COUNTER
|
||||
|
@ -1419,6 +1419,7 @@ void DumpTileSignalsInfo(char *buffer, const char *last, uint index, NIExtraInfo
|
||||
b += seprintf(b, last, " trackdir: %d, state: %d", td, state);
|
||||
if (_extra_aspects > 0 && state == SIGNAL_STATE_GREEN) seprintf(b, last, ", aspect: %d", GetSignalAspect(index, TrackdirToTrack(td)));
|
||||
if (GetSignalAlwaysReserveThrough(index, TrackdirToTrack(td))) seprintf(b, last, ", always reserve through");
|
||||
if (GetSignalSpecialPropagationFlag(index, TrackdirToTrack(td))) seprintf(b, last, ", special propagation flag");
|
||||
output.print(buffer);
|
||||
}
|
||||
}
|
||||
@ -1440,6 +1441,10 @@ void DumpTunnelBridgeSignalsInfo(char *buffer, const char *last, uint index, NIE
|
||||
if (_extra_aspects > 0 && state == SIGNAL_STATE_GREEN) b += seprintf(b, last, ", aspect: %d", GetTunnelBridgeExitSignalAspect(index));
|
||||
output.print(buffer);
|
||||
}
|
||||
if (GetTunnelBridgeSignalSpecialPropagationFlag(index)) {
|
||||
seprintf(buffer, last, " Special propagation flag");
|
||||
output.print(buffer);
|
||||
}
|
||||
TileIndex end = GetOtherTunnelBridgeEnd(index);
|
||||
extern uint GetTunnelBridgeSignalSimulationSignalCount(TileIndex begin, TileIndex end);
|
||||
seprintf(buffer, last, " Spacing: %d, total signals: %d", GetTunnelBridgeSignalSimulationSpacing(index), GetTunnelBridgeSignalSimulationSignalCount(index, end));
|
||||
|
@ -1740,6 +1740,7 @@ bool TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref)
|
||||
TraceRestrictProgram *prog = _tracerestrictprogram_pool.Get(iter->second.program_id);
|
||||
|
||||
bool update_reserve_through = (prog->actions_used_flags & TRPAUF_RESERVE_THROUGH_ALWAYS);
|
||||
bool update_special_propagation = (prog->actions_used_flags & TRPAUF_SPECIAL_ASPECT_PROPAGATION_FLAG_MASK);
|
||||
|
||||
/* Check to see if another mapping needs to be removed as well,
|
||||
* do this before decrementing the refcount */
|
||||
@ -1761,6 +1762,9 @@ bool TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref)
|
||||
if (update_reserve_through && IsTileType(tile, MP_RAILWAY)) {
|
||||
UpdateSignalReserveThroughBit(tile, track, true);
|
||||
}
|
||||
if (update_special_propagation) {
|
||||
UpdateSignalSpecialPropagationFlag(tile, track, nullptr, true);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -1778,6 +1782,15 @@ void TraceRestrictCheckRefreshSignals(const TraceRestrictProgram *prog, size_t o
|
||||
}
|
||||
}
|
||||
|
||||
if (((old_actions_used_flags ^ prog->actions_used_flags) & TRPAUF_SPECIAL_ASPECT_PROPAGATION_FLAG_MASK)) {
|
||||
const TraceRestrictRefId *data = prog->GetRefIdsPtr();
|
||||
for (uint i = 0; i < prog->refcount; i++) {
|
||||
TileIndex tile = GetTraceRestrictRefIdTileIndex(data[i]);
|
||||
Track track = GetTraceRestrictRefIdTrack(data[i]);
|
||||
UpdateSignalSpecialPropagationFlag(tile, track, prog, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsHeadless()) return;
|
||||
|
||||
if (!((old_actions_used_flags ^ prog->actions_used_flags) & (TRPAUF_RESERVE_THROUGH_ALWAYS | TRPAUF_REVERSE_BEHIND))) return;
|
||||
@ -1797,6 +1810,10 @@ void TraceRestrictCheckRefreshSingleSignal(const TraceRestrictProgram *prog, Tra
|
||||
Track track = GetTraceRestrictRefIdTrack(ref);
|
||||
if (IsTileType(tile, MP_RAILWAY)) UpdateSignalReserveThroughBit(tile, track, true);
|
||||
}
|
||||
|
||||
if (((old_actions_used_flags ^ prog->actions_used_flags) & TRPAUF_SPECIAL_ASPECT_PROPAGATION_FLAG_MASK)) {
|
||||
UpdateSignalSpecialPropagationFlag(GetTraceRestrictRefIdTileIndex(ref), GetTraceRestrictRefIdTrack(ref), prog, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,6 +483,8 @@ enum TraceRestrictProgramActionsUsedFlags : uint32_t {
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramActionsUsedFlags)
|
||||
|
||||
static constexpr TraceRestrictProgramActionsUsedFlags TRPAUF_SPECIAL_ASPECT_PROPAGATION_FLAG_MASK = TRPAUF_WAIT_AT_PBS | TRPAUF_REVERSE_AT | TRPAUF_PBS_RES_END_WAIT;
|
||||
|
||||
/**
|
||||
* Enumeration for TraceRestrictProgramInput::permitted_slot_operations
|
||||
*/
|
||||
|
@ -622,6 +622,18 @@ inline uint8_t GetTunnelBridgeSignalStyle(TileIndex t)
|
||||
}
|
||||
}
|
||||
|
||||
inline bool GetTunnelBridgeSignalSpecialPropagationFlag(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(IsRailTunnelBridgeTile(t), t);
|
||||
return HasBit(_m[t].m1, 5);
|
||||
}
|
||||
|
||||
inline void SetTunnelBridgeSignalSpecialPropagationFlag(TileIndex t, bool special)
|
||||
{
|
||||
dbg_assert_tile(IsRailTunnelBridgeTile(t), t);
|
||||
SB(_m[t].m1, 5, 1, special ? 1 : 0);
|
||||
}
|
||||
|
||||
void AddRailTunnelBridgeInfrastructure(Company *c, TileIndex begin, TileIndex end);
|
||||
void SubtractRailTunnelBridgeInfrastructure(Company *c, TileIndex begin, TileIndex end);
|
||||
void AddRailTunnelBridgeInfrastructure(TileIndex begin, TileIndex end);
|
||||
|
Loading…
Reference in New Issue
Block a user