diff options
author | rubidium <rubidium@openttd.org> | 2007-04-20 08:00:30 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-04-20 08:00:30 +0000 |
commit | 1951817f3b3682fc71c5986cb4aa5e768b32d789 (patch) | |
tree | e4ded69f86472e9bdd57f0fb69b501f675b34a9a /src/vehicle.cpp | |
parent | 12ddcd0a243e12d780af70c0562777f8d2217a1e (diff) | |
download | openttd-1951817f3b3682fc71c5986cb4aa5e768b32d789.tar.xz |
(svn r9683) -Fix [FS#423]: improved loading does not use a huge amount of processing power anymore when having a lot of trains.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 3a779c256..c14d376e1 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -570,6 +570,10 @@ bool IsEngineCountable(const Vehicle *v) void DestroyVehicle(Vehicle *v) { + if (v->last_station_visited != INVALID_STATION) { + GetStation(v->last_station_visited)->loading_vehicles.remove(v); + } + if (IsEngineCountable(v)) { GetPlayer(v->owner)->num_engines[v->engine_type]--; if (v->owner == _local_player) InvalidateAutoreplaceWindow(v->engine_type); @@ -2903,6 +2907,7 @@ void Vehicle::BeginLoading() { assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP); current_order.type = OT_LOADING; + GetStation(this->last_station_visited)->loading_vehicles.push_back(this); } void Vehicle::LeaveStation() @@ -2911,4 +2916,5 @@ void Vehicle::LeaveStation() assert(current_order.type == OT_LOADING); current_order.type = OT_LEAVESTATION; current_order.flags = 0; + GetStation(this->last_station_visited)->loading_vehicles.push_back(this); } |