summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-01-30 17:46:57 +0000
committercelestar <celestar@openttd.org>2005-01-30 17:46:57 +0000
commit6d1ee15b9ac8e559a749c61ce16a318ca30b2dff (patch)
tree9a03f32c3bfb8e4d45eb5faaec3fecf221870768 /station_cmd.c
parent1527ef3db001a1bb609f8c331313a52c9ac69888 (diff)
downloadopenttd-6d1ee15b9ac8e559a749c61ce16a318ca30b2dff.tar.xz
(svn r1735) -Fix: [ 1112285 ] Fixed an assertion error with stations where stops
were deleted, the assertions were just plain wrong at that place. Used a more graceful handling. Todo: What happens if ALL stations in a schedule have no suitable stop?
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/station_cmd.c b/station_cmd.c
index d8cc5800b..a1694a009 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -166,7 +166,18 @@ TileIndex GetStationTileForVehicle(const Vehicle *v, const Station *st)
case VEH_Train: return st->train_tile;
case VEH_Aircraft: return st->airport_tile;
case VEH_Ship: return st->dock_tile;
- case VEH_Road: return (v->cargo_type == CT_PASSENGERS) ? st->bus_stops->xy : st->truck_stops->xy;
+ case VEH_Road:
+ if (v->cargo_type == CT_PASSENGERS) {
+ if (st->bus_stops != NULL)
+ return st->bus_stops->xy;
+ else
+ return 0;
+ } else {
+ if (st->truck_stops != NULL)
+ return st->truck_stops->xy;
+ else
+ return 0;
+ }
default:
assert(false);
return 0;