From fdf86bb4a2682eca65d6eefe89c7023cd91d7630 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 20 Apr 2007 08:00:30 +0000 Subject: (svn r9683) -Fix [FS#423]: improved loading does not use a huge amount of processing power anymore when having a lot of trains. --- src/economy.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/economy.cpp') 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::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; -- cgit v1.2.3-54-g00ecf