Use vector instead of list for Station::loading_vehicles.

This commit is contained in:
Jonathan G Rennison
2016-09-13 18:31:55 +01:00
parent 95aad35774
commit e844b82d9e
6 changed files with 18 additions and 22 deletions

View File

@@ -60,6 +60,8 @@
#include "table/strings.h"
#include <algorithm>
#include "safeguards.h"
#define GEN_HASH(x, y) ((GB((y), 6 + ZOOM_LVL_SHIFT, 6) << 6) + GB((x), 7 + ZOOM_LVL_SHIFT, 6))
@@ -830,7 +832,7 @@ void Vehicle::PreDestructor()
if (Station::IsValidID(this->last_station_visited)) {
Station *st = Station::Get(this->last_station_visited);
st->loading_vehicles.remove(this);
st->loading_vehicles.erase(std::remove(st->loading_vehicles.begin(), st->loading_vehicles.end(), this), st->loading_vehicles.end());
HideFillingPercent(&this->fill_percent_te_id);
this->CancelReservation(INVALID_STATION, st);
@@ -2592,7 +2594,7 @@ void Vehicle::LeaveStation()
this->current_order.MakeLeaveStation();
Station *st = Station::Get(this->last_station_visited);
this->CancelReservation(INVALID_STATION, st);
st->loading_vehicles.remove(this);
st->loading_vehicles.erase(std::remove(st->loading_vehicles.begin(), st->loading_vehicles.end(), this), st->loading_vehicles.end());
HideFillingPercent(&this->fill_percent_te_id);
trip_occupancy = CalcPercentVehicleFilled(this, NULL);