mirror of https://github.com/OpenTTD/OpenTTD
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
parent
00c819c0d5
commit
6c825df8f7
6
npf.c
6
npf.c
|
@ -373,6 +373,12 @@ 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 */
|
||||
|
||||
/* 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 */
|
||||
|
|
|
@ -937,8 +937,11 @@ const SettingDesc patch_settings[] = {
|
|||
* again, just because the sign at the right side was red. If we take
|
||||
* a typical 5 length station, this detour is 10 or 11 tiles (not
|
||||
* sure), so we set the default penalty at 10 (the station tile
|
||||
* penalty will further prevent this */
|
||||
* penalty will further prevent this.
|
||||
* We give presignal exits (and combo's) a different (larger) penalty, because we really
|
||||
* don't want trains waiting in front of a presignal exit. */
|
||||
{"npf_rail_firstred_penalty", SDT_UINT32, (void*)(10 * NPF_TILE_LENGTH), &_patches.npf_rail_firstred_penalty, NULL},
|
||||
{"npf_rail_firstred_exit_penalty", SDT_UINT32, (void*)(100 * NPF_TILE_LENGTH), &_patches.npf_rail_firstred_exit_penalty, NULL},
|
||||
/* This penalty is for when the last signal before the target is red.
|
||||
* This is useful for train stations, where there are multiple
|
||||
* platforms to choose from, which lie in different signal blocks.
|
||||
|
|
|
@ -195,7 +195,8 @@ typedef struct Patches {
|
|||
/* New Path Finding */
|
||||
bool new_pathfinding_all; /* Use the newest pathfinding algorithm for all */
|
||||
|
||||
uint32 npf_rail_firstred_penalty; /* The penalty for when the first signal is red */
|
||||
uint32 npf_rail_firstred_penalty; /* The penalty for when the first signal is red (and it is not an exit or combo signal) */
|
||||
uint32 npf_rail_firstred_exit_penalty; /* The penalty for when the first signal is red (and it is an exit or combo signal) */
|
||||
uint32 npf_rail_lastred_penalty; /* The penalty for when the last signal is red */
|
||||
uint32 npf_rail_station_penalty; /* The penalty for station tiles */
|
||||
uint32 npf_rail_slope_penalty; /* The penalty for sloping upwards */
|
||||
|
|
Loading…
Reference in New Issue