summaryrefslogtreecommitdiff
path: root/npf.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-04-02 10:38:31 +0000
committertruelight <truelight@openttd.org>2005-04-02 10:38:31 +0000
commit5a527daac951515c53a94ea4fb26d5b737dc264d (patch)
tree2bb637e0ebf36abd8b06639bf93ba4a0c7ad16e3 /npf.c
parent1d0e0b22e439d95aebf370197e52a02c273db47f (diff)
downloadopenttd-5a527daac951515c53a94ea4fb26d5b737dc264d.tar.xz
(svn r2121) -Fix: changed the 2nd param of AyStar_EndNodeCheck back to what it should be
Diffstat (limited to 'npf.c')
-rw-r--r--npf.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/npf.c b/npf.c
index 3e8652a39..7f408d1b6 100644
--- a/npf.c
+++ b/npf.c
@@ -332,6 +332,8 @@ int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent) {
TileIndex tile = current->tile;
byte trackdir = current->direction;
int32 cost = 0;
+ OpenListNode new_node;
+
/* Determine base length */
switch (GetTileType(tile)) {
case MP_TUNNELBRIDGE:
@@ -384,7 +386,8 @@ int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent) {
/* Penalise the tile if it is a target tile and the last signal was
* red */
- if (as->EndNodeCheck(as, current)==AYSTAR_FOUND_END_NODE && NPFGetFlag(current, NPF_FLAG_LAST_SIGNAL_RED))
+ new_node.path.node = *current;
+ if (as->EndNodeCheck(as, &new_node)==AYSTAR_FOUND_END_NODE && NPFGetFlag(current, NPF_FLAG_LAST_SIGNAL_RED))
cost += _patches.npf_rail_lastred_penalty;
/* Check for slope */
@@ -409,8 +412,8 @@ int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent) {
}
/* Will find any depot */
-int32 NPFFindDepot(AyStar* as, AyStarNode *node) {
- TileIndex tile = node->tile;
+int32 NPFFindDepot(AyStar* as, OpenListNode *current) {
+ TileIndex tile = current->path.node.tile;
if (IsTileDepotType(tile, as->user_data[NPF_TYPE]))
return AYSTAR_FOUND_END_NODE;
else
@@ -418,8 +421,9 @@ int32 NPFFindDepot(AyStar* as, AyStarNode *node) {
}
/* Will find a station identified using the NPFFindStationOrTileData */
-int32 NPFFindStationOrTile(AyStar* as, AyStarNode *node) {
+int32 NPFFindStationOrTile(AyStar* as, OpenListNode *current) {
NPFFindStationOrTileData* fstd = (NPFFindStationOrTileData*)as->user_target;
+ AyStarNode *node = &current->path.node;
TileIndex tile = node->tile;
/* See if we checked this before */