summaryrefslogtreecommitdiff
path: root/src/pathfinder/npf/npf.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-02 18:12:24 +0000
committerrubidium <rubidium@openttd.org>2009-12-02 18:12:24 +0000
commit66da3cbb20bcaf29ed3b863c25b291527b56d44a (patch)
treeaca11abc42ffcc2d03407da8a96afa52e3d66211 /src/pathfinder/npf/npf.cpp
parent4ec4fdff36e96321773a2a087784e9fd4ec4105d (diff)
downloadopenttd-66da3cbb20bcaf29ed3b863c25b291527b56d44a.tar.xz
(svn r18383) -Fix (r18375): triggering NOT_REACHED for some waypoints
Diffstat (limited to 'src/pathfinder/npf/npf.cpp')
-rw-r--r--src/pathfinder/npf/npf.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp
index 9e6d0c2f3..1b9489f6b 100644
--- a/src/pathfinder/npf/npf.cpp
+++ b/src/pathfinder/npf/npf.cpp
@@ -453,7 +453,9 @@ static int32 NPFFindStationOrTile(AyStar *as, OpenListNode *current)
if (fstd->station_index == INVALID_STATION && tile == fstd->dest_coords) return AYSTAR_FOUND_END_NODE;
if (IsTileType(tile, MP_STATION) && GetStationIndex(tile) == fstd->station_index) {
- if (fstd->station_type == STATION_RAIL) return AYSTAR_FOUND_END_NODE;
+ if (fstd->v->type == VEH_TRAIN) return AYSTAR_FOUND_END_NODE;
+
+ assert(fstd->v->type == VEH_ROAD);
/* Only if it is a valid station *and* we can stop there */
if (GetStationType(tile) == fstd->station_type && (fstd->not_articulated || IsDriveThroughStopTile(tile))) return AYSTAR_FOUND_END_NODE;
}
@@ -1090,7 +1092,7 @@ void NPFFillWithOrderData(NPFFindStationOrTileData *fstd, const Vehicle *v, bool
if (v->type != VEH_SHIP && (v->current_order.IsType(OT_GOTO_STATION) || v->current_order.IsType(OT_GOTO_WAYPOINT))) {
assert(v->type == VEH_TRAIN || v->type == VEH_ROAD);
fstd->station_index = v->current_order.GetDestination();
- fstd->station_type = (v->type == VEH_TRAIN) ? STATION_RAIL : (RoadVehicle::From(v)->IsBus() ? STATION_BUS : STATION_TRUCK);
+ fstd->station_type = (v->type == VEH_TRAIN) ? (v->current_order.IsType(OT_GOTO_STATION) ? STATION_RAIL : STATION_WAYPOINT) : (RoadVehicle::From(v)->IsBus() ? STATION_BUS : STATION_TRUCK);
fstd->not_articulated = v->type == VEH_ROAD && !RoadVehicle::From(v)->HasArticulatedPart();
/* Let's take the closest tile of the station as our target for vehicles */
fstd->dest_coords = CalcClosestStationTile(fstd->station_index, v->tile, fstd->station_type);