Update to 12.0-beta1

This commit is contained in:
dP
2021-08-15 14:57:29 +03:00
parent ac7d3eba75
commit 9df4f2c4fc
666 changed files with 61302 additions and 20466 deletions

View File

@@ -315,11 +315,11 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF
SetDParamStr(0, grfconfig->GetName());
GetString(buffer, part1, lastof(buffer));
DEBUG(grf, 0, "%s", buffer + 3);
Debug(grf, 0, "{}", buffer + 3);
SetDParam(1, engine);
GetString(buffer, part2, lastof(buffer));
DEBUG(grf, 0, "%s", buffer + 3);
Debug(grf, 0, "{}", buffer + 3);
}
/**
@@ -843,11 +843,11 @@ void Vehicle::PreDestructor()
}
if (this->IsPrimaryVehicle()) {
DeleteWindowById(WC_VEHICLE_VIEW, this->index);
DeleteWindowById(WC_VEHICLE_ORDERS, this->index);
DeleteWindowById(WC_VEHICLE_REFIT, this->index);
DeleteWindowById(WC_VEHICLE_DETAILS, this->index);
DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index);
CloseWindowById(WC_VEHICLE_VIEW, this->index);
CloseWindowById(WC_VEHICLE_ORDERS, this->index);
CloseWindowById(WC_VEHICLE_REFIT, this->index);
CloseWindowById(WC_VEHICLE_DETAILS, this->index);
CloseWindowById(WC_VEHICLE_TIMETABLE, this->index);
SetWindowDirty(WC_COMPANY, this->owner);
OrderBackup::ClearVehicle(this);
}
@@ -953,9 +953,7 @@ void CallVehicleTicks()
PerformanceAccumulator::Reset(PFE_GL_AIRCRAFT);
for (Vehicle *v : Vehicle::Iterate()) {
#ifdef WITH_ASSERT
size_t vehicle_index = v->index;
#endif
[[maybe_unused]] size_t vehicle_index = v->index;
/* Vehicle could be deleted in this tick */
if (!v->Tick()) {
@@ -1639,13 +1637,19 @@ void Vehicle::UpdateBoundingBoxCoordinates(bool update_cache) const
*/
void Vehicle::UpdateViewport(bool dirty)
{
Rect old_coord = this->sprite_cache.old_coord;
/* If the existing cache is invalid we should ignore it, as it will be set to the current coords by UpdateBoundingBoxCoordinates */
bool ignore_cached_coords = this->sprite_cache.old_coord.left == INVALID_COORD;
this->UpdateBoundingBoxCoordinates(true);
UpdateVehicleViewportHash(this, this->coord.left, this->coord.top, old_coord.left, old_coord.top);
if (ignore_cached_coords) {
UpdateVehicleViewportHash(this, this->coord.left, this->coord.top, INVALID_COORD, INVALID_COORD);
} else {
UpdateVehicleViewportHash(this, this->coord.left, this->coord.top, this->sprite_cache.old_coord.left, this->sprite_cache.old_coord.top);
}
if (dirty) {
if (old_coord.left == INVALID_COORD) {
if (ignore_cached_coords) {
this->sprite_cache.is_viewport_candidate = this->MarkAllViewportsDirty();
} else {
this->sprite_cache.is_viewport_candidate = ::MarkAllViewportsDirty(
@@ -2227,7 +2231,7 @@ void Vehicle::CancelReservation(StationID next, Station *st)
for (Vehicle *v = this; v != nullptr; v = v->next) {
VehicleCargoList &cargo = v->cargo;
if (cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) {
DEBUG(misc, 1, "cancelling cargo reservation");
Debug(misc, 1, "cancelling cargo reservation");
cargo.Return(UINT_MAX, &st->goods[v->cargo_type].cargo, next);
cargo.SetTransferLoadPlace(st->xy);
}
@@ -2789,7 +2793,7 @@ void Vehicle::RemoveFromShared()
if (this->orders.list->GetNumVehicles() == 1) {
/* When there is only one vehicle, remove the shared order list window. */
DeleteWindowById(GetWindowClassForVehicleType(this->type), vli.Pack());
CloseWindowById(GetWindowClassForVehicleType(this->type), vli.Pack());
InvalidateVehicleOrder(this->FirstShared(), VIWD_MODIFY_ORDERS);
} else if (were_first) {
/* If we were the first one, update to the new first one.