roadveh_cmd.c
changeset 1231 64cc1f5c1c82
parent 1224 09b0f5a1db97
child 1232 c52bd2905b7d
--- a/roadveh_cmd.c	Sun Jan 30 16:54:39 2005 +0000
+++ b/roadveh_cmd.c	Sun Jan 30 17:46:57 2005 +0000
@@ -628,7 +628,14 @@
 			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 @@
 		//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 @@
 		firststop = stop = NULL;
 	}
 
+no_stop:
 	if (v->vehstatus & VS_STOPPED)
 		return;