mirror of https://github.com/OpenTTD/OpenTTD.git
(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:
parent
d7b4fb80d0
commit
c7d57379fb
|
@ -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();
|
||||
|
|
|
@ -69,5 +69,6 @@ int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, C
|
|||
uint MoveGoodsToStation(TileIndex tile, int w, int h, CargoID type, uint amount);
|
||||
|
||||
void VehiclePayment(Vehicle *front_v);
|
||||
void LoadUnloadStation(Station *st);
|
||||
|
||||
#endif /* ECONOMY_H */
|
||||
|
|
|
@ -659,8 +659,6 @@ static VehicleTickProc* _vehicle_tick_procs[] = {
|
|||
|
||||
void CallVehicleTicks()
|
||||
{
|
||||
Vehicle *v;
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
/* hotfix for desync problem:
|
||||
* for MP games invalidate the YAPF cache every tick to keep it exactly the same on the server and all clients */
|
||||
|
@ -671,6 +669,10 @@ void CallVehicleTicks()
|
|||
|
||||
_first_veh_in_depot_list = NULL; // now we are sure it's initialized at the start of each tick
|
||||
|
||||
Station *st;
|
||||
FOR_ALL_STATIONS(st) LoadUnloadStation(st);
|
||||
|
||||
Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
_vehicle_tick_procs[v->type](v);
|
||||
|
||||
|
@ -2933,17 +2935,8 @@ void Vehicle::HandleLoading(bool mode)
|
|||
{
|
||||
switch (this->current_order.type) {
|
||||
case OT_LOADING: {
|
||||
/* Not the first call for this tick */
|
||||
if (mode) return;
|
||||
|
||||
/* We have not waited enough time till the next round of loading/unloading */
|
||||
if (--this->load_unload_time_rem) return;
|
||||
|
||||
/* Load/unload the vehicle; when it actually did something
|
||||
* we do not leave the station. */
|
||||
LoadUnloadVehicle(this);
|
||||
|
||||
if (!HASBIT(this->vehicle_flags, VF_LOADING_FINISHED)) return;
|
||||
/* Not the first call for this tick, or still loading */
|
||||
if (mode || !HASBIT(this->vehicle_flags, VF_LOADING_FINISHED)) return;
|
||||
|
||||
this->PlayLeaveStationSound();
|
||||
|
||||
|
|
|
@ -521,8 +521,6 @@ void ShowAircraftViewWindow(const Vehicle* v);
|
|||
|
||||
UnitID GetFreeUnitNumber(byte type);
|
||||
|
||||
void LoadUnloadVehicle(Vehicle *v);
|
||||
|
||||
void TrainConsistChanged(Vehicle *v);
|
||||
void TrainPowerChanged(Vehicle *v);
|
||||
int32 GetTrainRunningCost(const Vehicle *v);
|
||||
|
|
Loading…
Reference in New Issue