Changeset - r1231:b2377ffda5b5
[Not reviewed]
master
0 2 0
celestar - 20 years ago 2005-01-30 17:46:57
celestar@openttd.org
(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?
2 files changed with 23 insertions and 3 deletions:
0 comments (0 inline, 0 general)
roadveh_cmd.c
Show inline comments
 
@@ -628,7 +628,14 @@ static void ProcessRoadVehOrder(Vehicle 
 
			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;
 

	
station_cmd.c
Show inline comments
 
@@ -166,7 +166,18 @@ TileIndex GetStationTileForVehicle(const
 
		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;
0 comments (0 inline, 0 general)