Changeset - r17307:95455536d763
[Not reviewed]
master
0 2 0
rubidium - 14 years ago 2011-02-11 09:33:38
rubidium@openttd.org
(svn r22057) -Fix: waypoint conversion could (previously) silently overfill the pool and crash
2 files changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/saveload/station_sl.cpp
Show inline comments
 
@@ -75,6 +75,9 @@ void MoveBuoysToWaypoints()
 
		/* Delete the station, so we can make it a real waypoint. */
 
		delete st;
 

	
 
		/* Stations and waypoints are in the same pool, so if a station
 
		 * is deleted there must be place for a Waypoint. */
 
		assert(Waypoint::CanAllocateItem());
 
		Waypoint *wp   = new (index) Waypoint(xy);
 
		wp->town       = town;
 
		wp->string_id  = train ? STR_SV_STNAME_WAYPOINT : STR_SV_STNAME_BUOY;
src/saveload/waypoint_sl.cpp
Show inline comments
 
@@ -93,6 +93,8 @@ void MoveWaypointsToBaseStations()
 
		}
 
	}
 

	
 
	if (!Waypoint::CanAllocateItem(_old_waypoints.Length())) SlError(STR_ERROR_TOO_MANY_STATIONS_LOADING);
 

	
 
	/* All saveload conversions have been done. Create the new waypoints! */
 
	for (OldWaypoint *wp = _old_waypoints.Begin(); wp != _old_waypoints.End(); wp++) {
 
		Waypoint *new_wp = new Waypoint(wp->xy);
0 comments (0 inline, 0 general)