diff options
author | truelight <truelight@openttd.org> | 2005-02-06 10:18:47 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-02-06 10:18:47 +0000 |
commit | e9c93f9c0ca76117ac1315b6aff03f1f138f62e4 (patch) | |
tree | 0b6bfe4dfd7abf3e94d0f7210b1b842e429c4a02 /npf.c | |
parent | 6493e12bfbb147e41fc0f533bb3618b2931fed1f (diff) | |
download | openttd-e9c93f9c0ca76117ac1315b6aff03f1f138f62e4.tar.xz |
(svn r1817) -Codechange: Moved depot-functions to depot.c
-Codechange: Added wrappers around depot-access (GetDepot no exists)
-Codechange: Made depot-functions a bit more logic (no longer
GetDepotByTile crashes your game when you request it on a non-depot tile)
-Add: made depots dynamic (yes, 64k depots are possible now)
Diffstat (limited to 'npf.c')
-rw-r--r-- | npf.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -7,6 +7,7 @@ #include "pathfind.h" #include "station.h" #include "tile.h" +#include "depot.h" AyStar _train_find_station; AyStar _train_find_depot; @@ -605,7 +606,6 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, byte trackdir, Tran * for ships, since the heuristic will not be to far off then. I hope. */ Queue depots; - uint i; TileType tiletype = 0; int r; NPFFoundTargetData best_result; @@ -613,6 +613,7 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, byte trackdir, Tran NPFFindStationOrTileData target; AyStarNode start; Depot* current; + Depot *depot; /* This is a little ugly, but it works :-S */ @@ -627,11 +628,9 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, byte trackdir, Tran init_InsSort(&depots); /* Okay, let's find all depots that we can use first */ - for (i=0;i<lengthof(_depots);i++) { - int depot_tile = _depots[i].xy; - if (IsTileType(depot_tile, tiletype)) - depots.push(&depots, &_depots[i], DistanceManhattan(tile, depot_tile)); - + FOR_ALL_DEPOTS(depot) { + if (IsTileType(depot->xy, tiletype)) + depots.push(&depots, depot, DistanceManhattan(tile, depot->xy)); } /* Now, let's initialise the aystar */ |