diff options
author | truelight <truelight@openttd.org> | 2005-04-02 10:38:31 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-04-02 10:38:31 +0000 |
commit | 5a527daac951515c53a94ea4fb26d5b737dc264d (patch) | |
tree | 2bb637e0ebf36abd8b06639bf93ba4a0c7ad16e3 /npf.c | |
parent | 1d0e0b22e439d95aebf370197e52a02c273db47f (diff) | |
download | openttd-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.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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 = ¤t->path.node; TileIndex tile = node->tile; /* See if we checked this before */ |