mirror of https://github.com/OpenTTD/OpenTTD
(svn r4376) -Codechange Renamed GetSignalState to GetSignalStateByTrackdir
parent
a8d4285ec2
commit
e79c36bf8c
2
npf.c
2
npf.c
|
@ -342,7 +342,7 @@ static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
|
||||||
/* Check for signals */
|
/* Check for signals */
|
||||||
if (IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, trackdir)) {
|
if (IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, trackdir)) {
|
||||||
/* Ordinary track with signals */
|
/* Ordinary track with signals */
|
||||||
if (GetSignalState(tile, trackdir) == SIGNAL_STATE_RED) {
|
if (GetSignalStateByTrackdir(tile, trackdir) == SIGNAL_STATE_RED) {
|
||||||
/* Signal facing us is red */
|
/* Signal facing us is red */
|
||||||
if (!NPFGetFlag(current, NPF_FLAG_SEEN_SIGNAL)) {
|
if (!NPFGetFlag(current, NPF_FLAG_SEEN_SIGNAL)) {
|
||||||
/* Penalize the first signal we
|
/* Penalize the first signal we
|
||||||
|
|
2
rail.h
2
rail.h
|
@ -414,7 +414,7 @@ static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
|
||||||
* Along meaning if you are currently driving on the given trackdir, this is
|
* Along meaning if you are currently driving on the given trackdir, this is
|
||||||
* the signal that is facing us (for which we stop when it's red).
|
* the signal that is facing us (for which we stop when it's red).
|
||||||
*/
|
*/
|
||||||
static inline SignalState GetSignalState(TileIndex tile, Trackdir trackdir)
|
static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
|
||||||
{
|
{
|
||||||
assert(IsValidTrackdir(trackdir));
|
assert(IsValidTrackdir(trackdir));
|
||||||
assert(HasSignalOnTrack(tile, TrackdirToTrack(trackdir)));
|
assert(HasSignalOnTrack(tile, TrackdirToTrack(trackdir)));
|
||||||
|
|
|
@ -1504,7 +1504,7 @@ static bool SetSignalsEnumProc(TileIndex tile, SetSignalsData *ssd, int track, u
|
||||||
if (HasSignalOnTrackdir(tile, track) && _m[tile].m4 & 2) {
|
if (HasSignalOnTrackdir(tile, track) && _m[tile].m4 & 2) {
|
||||||
// this is an exit signal that points out from the segment
|
// this is an exit signal that points out from the segment
|
||||||
ssd->presignal_exits++;
|
ssd->presignal_exits++;
|
||||||
if (GetSignalState(tile, track) != SIGNAL_STATE_RED)
|
if (GetSignalStateByTrackdir(tile, track) != SIGNAL_STATE_RED)
|
||||||
ssd->presignal_exits_free++;
|
ssd->presignal_exits_free++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1653,7 +1653,7 @@ static void ChangeSignalStates(SetSignalsData *ssd)
|
||||||
// subtract for dual combo signals so they don't count themselves
|
// subtract for dual combo signals so they don't count themselves
|
||||||
if (_m[tile].m4 & 2 && HasSignalOnTrackdir(tile, ssd->bit[i])) {
|
if (_m[tile].m4 & 2 && HasSignalOnTrackdir(tile, ssd->bit[i])) {
|
||||||
ex--;
|
ex--;
|
||||||
if (GetSignalState(tile, ssd->bit[i]) != SIGNAL_STATE_RED) exfree--;
|
if (GetSignalStateByTrackdir(tile, ssd->bit[i]) != SIGNAL_STATE_RED) exfree--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we have exits and none are free, make red.
|
// if we have exits and none are free, make red.
|
||||||
|
|
Loading…
Reference in New Issue