summaryrefslogtreecommitdiff
path: root/roadveh_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 /roadveh_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 'roadveh_cmd.c')
-rw-r--r--roadveh_cmd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 64e92d28f..53f63e013 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -628,7 +628,14 @@ static void ProcessRoadVehOrder(Vehicle *v)
num = GetNumRoadStops(st, type);
rs = GetPrimaryRoadStop(st, type);
- assert (rs != NULL);
+ if (rs == NULL) {
+ int i, validorders = 0;
+ //There is no stop left at the station, so don't even TRY to go there
+ v->cur_order_index++;
+ InvalidateVehicleOrder(v);
+
+ return;
+ }
dist = malloc(num * sizeof(int32));
@@ -1632,7 +1639,8 @@ void OnNewDay_RoadVeh(Vehicle *v)
//We do not have a slot, so make one
if (v->u.road.slot == NULL) {
//first we need to find out how far our stations are away.
- assert( rs != NULL);
+ if ( rs == NULL )
+ goto no_stop;
do {
stop->dist = 0xFFFFFFFF;
@@ -1688,6 +1696,7 @@ have_slot:
firststop = stop = NULL;
}
+no_stop:
if (v->vehstatus & VS_STOPPED)
return;