saveload.c
changeset 1284 06a52178bf46
parent 1282 e7a73ee62d2f
child 1299 0a6510cc889b
--- a/saveload.c	Fri Feb 04 14:45:32 2005 +0000
+++ b/saveload.c	Fri Feb 04 15:31:30 2005 +0000
@@ -917,10 +917,7 @@
 		case REF_STATION: return ((Station *)v)->index + 1;
 		case REF_TOWN:    return ((Town *)v)->index + 1;
 		case REF_ORDER:   return ((Order *)v)->index + 1;
-
-		case REF_ROADSTOPS:
-			//return ((byte*)v - (byte*)_roadstops) / sizeof(_roadstops[0]) + 1;
-			return (RoadStop *)v - _roadstops + 1;
+		case REF_ROADSTOPS: return ((RoadStop *)v)->index + 1;
 
 		default:
 			NOT_REACHED();
@@ -957,10 +954,12 @@
 				error("Towns: failed loading savegame: too many towns");
 			return GetTown(r - 1);
 		}
+		case REF_ROADSTOPS: {
+			if (!AddBlockIfNeeded(&_roadstop_pool, r - 1))
+				error("RoadStop: failed loading savegame: too many RoadStops");
+			return GetRoadStop(r - 1);
+		}
 
-		case REF_ROADSTOPS:
-			//return (byte*)_roadstops    + (r - 1) * sizeof(_roadstops[0]);
-			return &_roadstops[r - 1];
 		case REF_VEHICLE_OLD: {
 			/* Old vehicles were saved differently: invalid vehicle was 0xFFFF,
 			    and the index was not - 1.. correct for this */