(svn r3939) -Fix: No longer assume that the number of slots is 2. It was not a problem up to now, but it's not The Right Thing (TM) to do either
authorcelestar
Sat, 18 Mar 2006 08:00:27 +0000
changeset 3251 2c5a8fecc825
parent 3250 bf64b3e5f8db
child 3252 fb8df0423442
(svn r3939) -Fix: No longer assume that the number of slots is 2. It was not a problem up to now, but it's not The Right Thing (TM) to do either
console_cmds.c
oldloader.c
station_cmd.c
--- a/console_cmds.c	Fri Mar 17 23:47:03 2006 +0000
+++ b/console_cmds.c	Sat Mar 18 08:00:27 2006 +0000
@@ -109,7 +109,8 @@
 	}
 
 	FOR_ALL_ROADSTOPS(rs) {
-		rs->slot[0] = rs->slot[1] = INVALID_VEHICLE;
+		int i;
+		for (i = 0; i < NUM_SLOTS; i++) rs->slot[i] = INVALID_VEHICLE;
 	}
 
 	return true;
--- a/oldloader.c	Fri Mar 17 23:47:03 2006 +0000
+++ b/oldloader.c	Sat Mar 18 08:00:27 2006 +0000
@@ -356,6 +356,7 @@
 static void FixOldStations(void)
 {
 	Station *st;
+	int i;
 
 	FOR_ALL_STATIONS(st) {
 		/* Check if we need to swap width and height for the station */
@@ -372,7 +373,7 @@
 			st->bus_stops->station = st->index;
 			st->bus_stops->next = NULL;
 			st->bus_stops->prev = NULL;
-			st->bus_stops->slot[0] = st->bus_stops->slot[1] = INVALID_VEHICLE;
+			for (i = 0; i < NUM_SLOTS; i++) st->bus_stops->slot[i] = INVALID_VEHICLE;
 		}
 
 		if (st->lorry_tile_obsolete != 0) {
@@ -383,7 +384,7 @@
 			st->truck_stops->station = st->index;
 			st->truck_stops->next = NULL;
 			st->truck_stops->prev = NULL;
-			st->truck_stops->slot[0] = st->truck_stops->slot[1] = INVALID_VEHICLE;
+			for (i = 0; i < NUM_SLOTS; i++) st->truck_stops->slot[i] = INVALID_VEHICLE;
 		}
 	}
 }
--- a/station_cmd.c	Fri Mar 17 23:47:03 2006 +0000
+++ b/station_cmd.c	Sat Mar 18 08:00:27 2006 +0000
@@ -86,13 +86,15 @@
 
 static void InitializeRoadStop(RoadStop *road_stop, RoadStop *previous, TileIndex tile, StationID index)
 {
+	int i;
 	road_stop->xy = tile;
 	road_stop->used = true;
 	road_stop->status = 3; //stop is free
-	road_stop->slot[0] = road_stop->slot[1] = INVALID_VEHICLE;
 	road_stop->next = NULL;
 	road_stop->prev = previous;
 	road_stop->station = index;
+
+	for (i = 0; i < NUM_SLOTS; i++) road_stop->slot[i] = INVALID_VEHICLE;
 }
 
 RoadStop* GetPrimaryRoadStop(const Station* st, RoadStopType type)