summaryrefslogtreecommitdiff
path: root/npf.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-04-04 17:53:39 +0000
committermatthijs <matthijs@openttd.org>2005-04-04 17:53:39 +0000
commit6c825df8f76442acf61f0c2f01620bdbff8a776f (patch)
tree99922c71839c7787413ed4d520b38e4542cb1267 /npf.c
parent00c819c0d5e2e64717d6c7968f477cb4642a94d5 (diff)
downloadopenttd-6c825df8f76442acf61f0c2f01620bdbff8a776f.tar.xz
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
Diffstat (limited to 'npf.c')
-rw-r--r--npf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/npf.c b/npf.c
index 7f408d1b6..3b50055a5 100644
--- a/npf.c
+++ b/npf.c
@@ -373,7 +373,13 @@ int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent) {
if (!NPFGetFlag(current, NPF_FLAG_SEEN_SIGNAL)) {
/* Penalize the first signal we
* encounter, if it is red */
- cost += _patches.npf_rail_firstred_penalty;
+
+ /* Is this a presignal exit or combo? */
+ if ((_map3_hi[tile] & 0x3) == 0x2 || (_map3_hi[tile] & 0x3) == 0x3)
+ /* Penalise exit and combo signals differently (heavier) */
+ cost += _patches.npf_rail_firstred_exit_penalty;
+ else
+ cost += _patches.npf_rail_firstred_penalty;
}
/* Record the state of this signal */
NPFSetFlag(current, NPF_FLAG_LAST_SIGNAL_RED, true);