summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-04-20 08:00:30 +0000
committerrubidium <rubidium@openttd.org>2007-04-20 08:00:30 +0000
commitfdf86bb4a2682eca65d6eefe89c7023cd91d7630 (patch)
treee4ded69f86472e9bdd57f0fb69b501f675b34a9a /src/vehicle.cpp
parenta8350e5fdf4e11599bfadfed80775aa6639b1322 (diff)
downloadopenttd-fdf86bb4a2682eca65d6eefe89c7023cd91d7630.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.cpp6
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);
}