(svn r22057) -Fix: waypoint conversion could (previously) silently overfill the pool and crash

This commit is contained in:
rubidium
2011-02-11 09:33:38 +00:00
parent 246f6fe478
commit 13fd2cd335
2 changed files with 5 additions and 0 deletions

View File

@@ -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;