Merge tag '13.0-beta1' into jgrpp
This commit is contained in:
@@ -450,6 +450,7 @@ Vehicle::Vehicle(VehicleType type)
|
||||
this->cargo_age_counter = 1;
|
||||
this->last_station_visited = INVALID_STATION;
|
||||
this->last_loading_station = INVALID_STATION;
|
||||
this->last_loading_tick = 0;
|
||||
this->cur_image_valid_dir = INVALID_DIR;
|
||||
this->vcache.cached_veh_flags = 0;
|
||||
}
|
||||
@@ -3140,9 +3141,9 @@ void Vehicle::DeleteUnreachedImplicitOrders()
|
||||
*/
|
||||
static void VehicleIncreaseStats(const Vehicle *front)
|
||||
{
|
||||
uint32 travel_time = front->current_order_time;
|
||||
for (const Vehicle *v = front; v != nullptr; v = v->Next()) {
|
||||
StationID last_loading_station = HasBit(front->vehicle_flags, VF_LAST_LOAD_ST_SEP) ? v->last_loading_station : front->last_loading_station;
|
||||
uint64 loading_tick = HasBit(front->vehicle_flags, VF_LAST_LOAD_ST_SEP) ? v->last_loading_tick : front->last_loading_tick;
|
||||
if (v->refit_cap > 0 &&
|
||||
last_loading_station != INVALID_STATION &&
|
||||
last_loading_station != front->last_station_visited &&
|
||||
@@ -3157,7 +3158,7 @@ static void VehicleIncreaseStats(const Vehicle *front)
|
||||
EdgeUpdateMode restricted_mode = EUM_INCREASE;
|
||||
if (v->type == VEH_AIRCRAFT) restricted_mode |= EUM_AIRCRAFT;
|
||||
IncreaseStats(Station::Get(last_loading_station), v->cargo_type, front->last_station_visited, v->refit_cap,
|
||||
std::min<uint>(v->refit_cap, v->cargo.StoredCount()), travel_time, restricted_mode);
|
||||
std::min<uint>(v->refit_cap, v->cargo.StoredCount()), _tick_counter - loading_tick, restricted_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3378,6 +3379,7 @@ void Vehicle::LeaveStation()
|
||||
|
||||
/* if the vehicle could load here or could stop with cargo loaded set the last loading station */
|
||||
this->last_loading_station = this->last_station_visited;
|
||||
this->last_loading_tick = _tick_counter;
|
||||
ClrBit(this->vehicle_flags, VF_LAST_LOAD_ST_SEP);
|
||||
} else if (cargoes_can_leave_with_cargo == 0) {
|
||||
/* can leave with no cargoes */
|
||||
@@ -3391,16 +3393,20 @@ void Vehicle::LeaveStation()
|
||||
|
||||
/* NB: this is saved here as we overwrite it on the first iteration of the loop below */
|
||||
StationID head_last_loading_station = this->last_loading_station;
|
||||
uint64 head_last_loading_tick = this->last_loading_tick;
|
||||
for (Vehicle *u = this; u != nullptr; u = u->Next()) {
|
||||
StationID last_loading_station = HasBit(this->vehicle_flags, VF_LAST_LOAD_ST_SEP) ? u->last_loading_station : head_last_loading_station;
|
||||
uint64 last_loading_tick = HasBit(this->vehicle_flags, VF_LAST_LOAD_ST_SEP) ? u->last_loading_tick : head_last_loading_tick;
|
||||
if (u->cargo_type < NUM_CARGO && HasBit(cargoes_can_load_unload, u->cargo_type)) {
|
||||
if (HasBit(cargoes_can_leave_with_cargo, u->cargo_type)) {
|
||||
u->last_loading_station = this->last_station_visited;
|
||||
u->last_loading_tick = _tick_counter;
|
||||
} else {
|
||||
u->last_loading_station = INVALID_STATION;
|
||||
}
|
||||
} else {
|
||||
u->last_loading_station = last_loading_station;
|
||||
u->last_loading_tick = last_loading_tick;
|
||||
}
|
||||
}
|
||||
SetBit(this->vehicle_flags, VF_LAST_LOAD_ST_SEP);
|
||||
|
Reference in New Issue
Block a user