(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.

This commit is contained in:
rubidium
2007-05-14 16:07:05 +00:00
parent d7b4fb80d0
commit c7d57379fb
4 changed files with 27 additions and 18 deletions

View File

@@ -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();