(svn r8137) -Fix (FS#551, r4259, r4320): roadstop->num_vehicles was wrong for savegames with version 24 or lower and do not calculate roadstop->num_vehicles when reading the roadstops as the vehicles might not be loaded at that moment.
authorrubidium
Sun, 14 Jan 2007 23:09:25 +0000
changeset 5928 d57921d78ee6
parent 5927 d740cab19ca0
child 5929 2a5f9609e04d
(svn r8137) -Fix (FS#551, r4259, r4320): roadstop->num_vehicles was wrong for savegames with version 24 or lower and do not calculate roadstop->num_vehicles when reading the roadstops as the vehicles might not be loaded at that moment.
src/openttd.cpp
src/station_cmd.cpp
--- a/src/openttd.cpp	Sun Jan 14 23:02:12 2007 +0000
+++ b/src/openttd.cpp	Sun Jan 14 23:09:25 2007 +0000
@@ -1553,6 +1553,11 @@
 				v->u.road.slot_age = 0;
 			}
 		}
+	} else {
+		Vehicle *v;
+		FOR_ALL_VEHICLES(v) {
+			if (v->type == VEH_Road && v->u.road.slot != NULL) v->u.road.slot->num_vehicles++;
+		}
 	}
 
 	if (CheckSavegameVersion(26)) {
--- a/src/station_cmd.cpp	Sun Jan 14 23:02:12 2007 +0000
+++ b/src/station_cmd.cpp	Sun Jan 14 23:09:25 2007 +0000
@@ -3060,7 +3060,6 @@
 static void Load_ROADSTOP(void)
 {
 	int index;
-	Vehicle *v;
 
 	while ((index = SlIterateArray()) != -1) {
 		RoadStop *rs;
@@ -3071,10 +3070,6 @@
 		rs = GetRoadStop(index);
 		SlObject(rs, _roadstop_desc);
 	}
-
-	FOR_ALL_VEHICLES(v) {
-		if (v->type == VEH_Road && v->u.road.slot != NULL) v->u.road.slot->num_vehicles++;
-	}
 }
 
 extern const ChunkHandler _station_chunk_handlers[] = {