@@ -460,9 +460,11 @@ inline int RoadVehicle::GetCurrentMaxSpe
*/
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);
@@ -3432,6 +3432,7 @@ static void DeleteLastWagon(Train *v)
if (first->track == TRACK_BIT_DEPOT) {
SetWindowDirty(WC_VEHICLE_DEPOT, first->tile);
}
/* 'v' shouldn't be accessed after it has been deleted */
@@ -270,6 +270,8 @@ Vehicle::Vehicle(VehicleType type)
this->first = this;
this->colourmap = PAL_NONE;
this->cargo_age_counter = 1;
this->last_station_visited = INVALID_STATION;
this->last_loading_station = INVALID_STATION;
/**
Status change: