summaryrefslogtreecommitdiff
path: root/ai_pathfinder.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-03-08 19:54:10 +0000
committermatthijs <matthijs@openttd.org>2005-03-08 19:54:10 +0000
commit232e41f2ff867bd1281c76ec3037d11cb5db0e65 (patch)
tree7d68f4e80ab28c8986de0bee20322d0bddcad0c9 /ai_pathfinder.c
parentd781d7ec000c99dc5ce7ed15e68c56ef582d0e22 (diff)
downloadopenttd-232e41f2ff867bd1281c76ec3037d11cb5db0e65.tar.xz
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
- Add: [NPF] NPFGetFlag() and NPFSetFlag() to wrap NPF node flag handling
Diffstat (limited to 'ai_pathfinder.c')
-rw-r--r--ai_pathfinder.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ai_pathfinder.c b/ai_pathfinder.c
index 76471a123..fe8c4d5ca 100644
--- a/ai_pathfinder.c
+++ b/ai_pathfinder.c
@@ -50,14 +50,19 @@ static bool IsRoad(TileIndex tile)
#define TILES_BETWEEN(a, b, c) (TileX(a) >= TileX(b) && TileX(a) <= TileX(c) && TileY(a) >= TileY(b) && TileY(a) <= TileY(c))
// Check if the current tile is in our end-area
-static int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, OpenListNode *current)
+static int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, AyStarNode *node)
{
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
// It is not allowed to have a station on the end of a bridge or tunnel ;)
- if (current->path.node.user_data[0] != 0) return AYSTAR_DONE;
- if (TILES_BETWEEN(current->path.node.tile, PathFinderInfo->end_tile_tl, PathFinderInfo->end_tile_br))
- if (IsTileType(current->path.node.tile, MP_CLEAR) || IsTileType(current->path.node.tile, MP_TREES))
- if (current->path.parent == NULL || TestCanBuildStationHere(current->path.node.tile,AiNew_GetDirection(current->path.parent->node.tile, current->path.node.tile)))
+ if (node->user_data[0] != 0) return AYSTAR_DONE;
+ if (TILES_BETWEEN(node->tile, PathFinderInfo->end_tile_tl, PathFinderInfo->end_tile_br))
+ if (IsTileType(node->tile, MP_CLEAR) || IsTileType(node->tile, MP_TREES))
+ /* XXX: The next line used to be here, but the argument to this function
+ * changed to an AyStarNode* instead of an OpenListNode*, so we don't
+ * have the parent available here anymore. Still, if we can build a
+ * station in anyone direction, we can build it in any direction, right?*/
+ // if (current->path.parent == NULL || TestCanBuildStationHere(node->tile,AiNew_GetDirection(current->path.parent->node.tile, node->tile)))
+ if ( TestCanBuildStationHere(node->tile,0))
return AYSTAR_FOUND_END_NODE;
return AYSTAR_DONE;