diff options
author | rubidium <rubidium@openttd.org> | 2007-05-14 16:07:05 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-05-14 16:07:05 +0000 |
commit | c7d57379fbdda52590cddb83240934da6b5e8b21 (patch) | |
tree | 689c15a9e4c69b6092adb8178a4209a3fc4ed27b /src/economy.cpp | |
parent | d7b4fb80d0e14ca3f8d56cda920e7f0d4e81419d (diff) | |
download | openttd-c7d57379fbdda52590cddb83240934da6b5e8b21.tar.xz |
(svn r9836) -Codechange: make non-improved loading happen FIFO-ish; generally loading/unloading will happen fifo, but there are no guarantees on the FIFO-ness. For (better) FIFO guarantees you still need to use improved loading.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index bb90cb488..91679412c 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1482,8 +1482,13 @@ void VehiclePayment(Vehicle *front_v) * Loads/unload the vehicle if possible. * @param v the vehicle to be (un)loaded */ -void LoadUnloadVehicle(Vehicle *v) +static void LoadUnloadVehicle(Vehicle *v) { + assert(v->current_order.type == OT_LOADING); + + /* We have not waited enough time till the next round of loading/unloading */ + if (--v->load_unload_time_rem != 0) return; + int unloading_time = 0; Vehicle *u = v; int result = 0; @@ -1496,8 +1501,6 @@ void LoadUnloadVehicle(Vehicle *v) uint32 cargo_full = 0; int total_cargo_feeder_share = 0; // the feeder cash amount for the goods being loaded/unloaded in this load step - assert(v->current_order.type == OT_LOADING); - v->cur_speed = 0; StationID last_visited = v->last_station_visited; @@ -1706,6 +1709,20 @@ void LoadUnloadVehicle(Vehicle *v) } } +/** + * Load/unload the vehicles in this station according to the order + * they entered. + * @param st the station to do the loading/unloading for + */ +void LoadUnloadStation(Station *st) +{ + std::list<Vehicle *>::iterator iter; + for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) { + Vehicle *v = *iter; + if (!(v->vehstatus & (VS_STOPPED | VS_CRASHED))) LoadUnloadVehicle(v); + } +} + void PlayersMonthlyLoop() { PlayersGenStatistics(); |