summaryrefslogtreecommitdiff
path: root/src/economy.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/economy.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/economy.cpp')
-rw-r--r--src/economy.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index c78d0a8a4..6b8280587 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1331,7 +1331,6 @@ static int32 DeliverGoods(int num_pieces, CargoID cargo_type, StationID source,
static bool LoadWait(const Vehicle* v, const Vehicle* u)
{
const Vehicle *w;
- const Vehicle *x;
bool has_any_cargo = false;
if (!(u->current_order.flags & OF_FULL_LOAD)) return false;
@@ -1346,12 +1345,11 @@ static bool LoadWait(const Vehicle* v, const Vehicle* u)
}
}
- FOR_ALL_VEHICLES(x) {
- if ((x->type != VEH_TRAIN || IsFrontEngine(x)) && // for all locs
- u->last_station_visited == x->last_station_visited && // at the same station
- !(x->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
- x->current_order.type == OT_LOADING && // loading
- u != x) { // not itself
+ const Station *st = GetStation(u->last_station_visited);
+ std::list<Vehicle *>::const_iterator iter;
+ for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
+ const Vehicle *x = *iter;
+ if (!(x->vehstatus & (VS_STOPPED | VS_CRASHED)) && u != x) {
bool other_has_any_cargo = false;
bool has_space_for_same_type = false;
bool other_has_same_type = false;