mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-09 19:10:38 +00:00
Fix minor code style issue
This commit is contained in:
parent
f8b008cd28
commit
bea66c4beb
@ -300,7 +300,7 @@ private:
|
||||
if (GetSignalType(tile, TrackdirToTrack(trackdir)) == SIGTYPE_PBS && !HasSignalOnTrackdir(tile, trackdir)) {
|
||||
flags_to_check |= TRPAUF_REVERSE;
|
||||
}
|
||||
if (prog && prog->actions_used_flags & flags_to_check) {
|
||||
if (prog != nullptr && prog->actions_used_flags & flags_to_check) {
|
||||
prog->Execute(Yapf().GetVehicle(), TraceRestrictProgramInput(tile, trackdir, &TraceRestrictPreviousSignalCallback, &n), out);
|
||||
if (out.flags & TRPRF_RESERVE_THROUGH && is_res_through != nullptr) {
|
||||
*is_res_through = true;
|
||||
@ -326,7 +326,7 @@ private:
|
||||
{
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(trackdir));
|
||||
TraceRestrictProgramActionsUsedFlags flags_to_check = TRPAUF_PF;
|
||||
if (prog && prog->actions_used_flags & flags_to_check) {
|
||||
if (prog != nullptr && prog->actions_used_flags & flags_to_check) {
|
||||
prog->Execute(Yapf().GetVehicle(), TraceRestrictProgramInput(tile, trackdir, &TraceRestrictPreviousSignalCallback, &n), out);
|
||||
if (out.flags & TRPRF_DENY) {
|
||||
n.m_segment->m_end_segment_reason |= ESRB_DEAD_END;
|
||||
@ -428,7 +428,7 @@ public:
|
||||
if (IsNoEntrySignal(sig_type)) {
|
||||
if (ShouldCheckTraceRestrict(n, tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(trackdir));
|
||||
if (prog && prog->actions_used_flags & TRPAUF_PF) {
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_PF) {
|
||||
TraceRestrictProgramResult out;
|
||||
prog->Execute(Yapf().GetVehicle(), TraceRestrictProgramInput(tile, trackdir, &TraceRestrictPreviousSignalCallback, &n), out);
|
||||
if (out.flags & TRPRF_DENY) {
|
||||
|
@ -366,7 +366,7 @@ static uint16_t ApplyTunnelBridgeLookaheadSignalSpeedRestriction(TileIndex tile,
|
||||
trackdir = GetTunnelBridgeExitTrackdir(tile);
|
||||
}
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(trackdir));
|
||||
if (prog && prog->actions_used_flags & TRPAUF_SPEED_RESTRICTION) {
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_SPEED_RESTRICTION) {
|
||||
TraceRestrictProgramResult out;
|
||||
TraceRestrictProgramInput input(tile, trackdir, nullptr, nullptr);
|
||||
prog->Execute(v, input, out);
|
||||
@ -650,7 +650,7 @@ static PBSTileInfo FollowReservation(Owner o, RailTypes rts, TileIndex tile, Tra
|
||||
uint16_t speed_restriction = lookahead->speed_restriction;
|
||||
if (v != nullptr) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(trackdir));
|
||||
if (prog && prog->actions_used_flags & au_flags) {
|
||||
if (prog != nullptr && prog->actions_used_flags & au_flags) {
|
||||
TraceRestrictProgramResult out;
|
||||
TraceRestrictProgramInput input(tile, trackdir, nullptr, nullptr);
|
||||
prog->Execute(v, input, out);
|
||||
@ -1507,7 +1507,7 @@ bool IsSafeWaitingPosition(const Train *v, TileIndex tile, Trackdir trackdir, bo
|
||||
if (GetSignalAlwaysReserveThrough(ft.m_new_tile, TrackdirToTrack(td))) return false;
|
||||
if (IsRestrictedSignal(ft.m_new_tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(ft.m_new_tile, TrackdirToTrack(td));
|
||||
if (prog && prog->actions_used_flags & TRPAUF_RESERVE_THROUGH) {
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_RESERVE_THROUGH) {
|
||||
TraceRestrictProgramResult out;
|
||||
prog->Execute(v, TraceRestrictProgramInput(ft.m_new_tile, td, &VehiclePosTraceRestrictPreviousSignalCallback, nullptr), out);
|
||||
if (out.flags & TRPRF_RESERVE_THROUGH) {
|
||||
|
@ -1576,7 +1576,7 @@ void DetermineCombineNormalShuntModeWithLookahead(Train *v, TileIndex tile, Trac
|
||||
|
||||
if (IsRestrictedSignal(tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(trackdir));
|
||||
if (prog && prog->actions_used_flags & TRPAUF_CMB_SIGNAL_MODE_CTRL) {
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_CMB_SIGNAL_MODE_CTRL) {
|
||||
TraceRestrictProgramResult out;
|
||||
TraceRestrictProgramInput input(tile, trackdir, [](const Train *v, const void *, TraceRestrictPBSEntrySignalAuxField mode) {
|
||||
if (mode == TRPESAF_RES_END_TILE) {
|
||||
@ -1973,7 +1973,7 @@ void UpdateSignalReserveThroughBit(TileIndex tile, Track track, bool update_sign
|
||||
} else {
|
||||
if (IsRestrictedSignal(tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, track);
|
||||
if (prog && prog->actions_used_flags & TRPAUF_RESERVE_THROUGH_ALWAYS) reserve_through = true;
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_RESERVE_THROUGH_ALWAYS) reserve_through = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4258,7 +4258,7 @@ static bool HasLongReservePbsSignalOnTrackdir(Train* v, TileIndex tile, Trackdir
|
||||
if (IsNoEntrySignal(tile, TrackdirToTrack(trackdir))) return false;
|
||||
if (IsRestrictedSignal(tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(trackdir));
|
||||
if (prog && prog->actions_used_flags & TRPAUF_LONG_RESERVE) {
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_LONG_RESERVE) {
|
||||
TraceRestrictProgramResult out;
|
||||
if (default_value) out.flags |= TRPRF_LONG_RESERVE;
|
||||
TraceRestrictProgramInput input(tile, trackdir, &VehiclePosTraceRestrictPreviousSignalCallback, nullptr);
|
||||
@ -4441,7 +4441,7 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir,
|
||||
if (track != INVALID_TRACK && HasPbsSignalOnTrackdir(tile, TrackEnterdirToTrackdir(track, enterdir)) && !IsNoEntrySignal(tile, track)) {
|
||||
if (IsRestrictedSignal(tile) && v->force_proceed != TFP_SIGNAL) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, track);
|
||||
if (prog && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE | TRPAUF_TRAIN_NOT_STUCK)) {
|
||||
if (prog != nullptr && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE | TRPAUF_TRAIN_NOT_STUCK)) {
|
||||
TraceRestrictProgramResult out;
|
||||
TraceRestrictProgramInput input(tile, TrackEnterdirToTrackdir(track, enterdir), nullptr, nullptr);
|
||||
input.permitted_slot_operations = TRPISP_ACQUIRE;
|
||||
@ -5326,7 +5326,7 @@ static bool CheckTrainStayInWormHolePathReserve(Train *t, TileIndex tile)
|
||||
auto try_exit_reservation = [&]() -> bool {
|
||||
if (IsTunnelBridgeRestrictedSignal(tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(td));
|
||||
if (prog && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE)) {
|
||||
if (prog != nullptr && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE)) {
|
||||
TraceRestrictProgramResult out;
|
||||
TraceRestrictProgramInput input(tile, td, nullptr, nullptr);
|
||||
input.permitted_slot_operations = TRPISP_ACQUIRE;
|
||||
@ -5932,7 +5932,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
||||
|
||||
if (IsTunnelBridgeRestrictedSignal(old_tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(old_tile, track);
|
||||
if (prog && prog->actions_used_flags & TRPAUF_SLOT_RELEASE_BACK) {
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_SLOT_RELEASE_BACK) {
|
||||
TraceRestrictProgramResult out;
|
||||
TraceRestrictProgramInput input(old_tile, trackdir, nullptr, nullptr);
|
||||
input.permitted_slot_operations = TRPISP_RELEASE_BACK;
|
||||
@ -6173,7 +6173,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
||||
if (HasSignalOnTrack(gp.old_tile, track)) {
|
||||
if (IsRestrictedSignal(gp.old_tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(gp.old_tile, track);
|
||||
if (prog && prog->actions_used_flags & TRPAUF_SLOT_RELEASE_BACK) {
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_SLOT_RELEASE_BACK) {
|
||||
TraceRestrictProgramResult out;
|
||||
TraceRestrictProgramInput input(gp.old_tile, ReverseTrackdir(rev_trackdir), nullptr, nullptr);
|
||||
input.permitted_slot_operations = TRPISP_RELEASE_BACK;
|
||||
@ -6191,7 +6191,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
||||
if (TrackdirEntersTunnelBridge(gp.old_tile, rev_trackdir)) {
|
||||
if (IsTunnelBridgeRestrictedSignal(gp.old_tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(gp.old_tile, track);
|
||||
if (prog && prog->actions_used_flags & TRPAUF_SLOT_RELEASE_BACK) {
|
||||
if (prog != nullptr && prog->actions_used_flags & TRPAUF_SLOT_RELEASE_BACK) {
|
||||
TraceRestrictProgramResult out;
|
||||
TraceRestrictProgramInput input(gp.old_tile, ReverseTrackdir(rev_trackdir), nullptr, nullptr);
|
||||
input.permitted_slot_operations = TRPISP_RELEASE_BACK;
|
||||
|
Loading…
Reference in New Issue
Block a user