forked from mirror/OpenTTD
(svn r25319) -Fix [FS#5570]: crash when train with reserved cargo vanishes
This commit is contained in:
@@ -460,9 +460,11 @@ inline int RoadVehicle::GetCurrentMaxSpeed() const
|
||||
*/
|
||||
static void DeleteLastRoadVeh(RoadVehicle *v)
|
||||
{
|
||||
RoadVehicle *first = v->First();
|
||||
Vehicle *u = v;
|
||||
for (; v->Next() != NULL; v = v->Next()) u = v;
|
||||
u->SetNext(NULL);
|
||||
v->last_station_visited = first->last_station_visited; // for PreDestructor
|
||||
|
||||
/* Only leave the road stop when we're really gone. */
|
||||
if (IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v);
|
||||
|
Reference in New Issue
Block a user