From 289012767544bbc909e19eb0452aac84ce2f8441 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 9 Sep 2023 21:24:46 +0200 Subject: [PATCH] Codechange: remove loaded_at_xy from CargoPacket as it was unused (#11276) (cherry picked from commit b0e73277d61fb291425cf1a85a631210993ab2e8) --- src/cargoaction.cpp | 2 -- src/cargoaction.h | 10 +++--- src/cargopacket.cpp | 34 ++++-------------- src/cargopacket.h | 40 ++++----------------- src/economy.cpp | 6 ++-- src/saveload/cargopacket_sl.cpp | 1 - src/saveload/compat/cargopacket_sl_compat.h | 2 +- src/saveload/compat/vehicle_sl_compat.h | 2 +- src/saveload/station_sl.cpp | 2 +- src/saveload/vehicle_sl.cpp | 4 +-- src/sl/cargopacket_sl.cpp | 4 +-- src/sl/oldloader_sl.cpp | 2 +- src/sl/saveload_common.h | 1 + src/sl/station_sl.cpp | 2 +- src/sl/vehicle_sl.cpp | 5 ++- src/vehicle.cpp | 1 - 16 files changed, 29 insertions(+), 89 deletions(-) diff --git a/src/cargoaction.cpp b/src/cargoaction.cpp index c1b7d95cb9..672fc9f9a0 100644 --- a/src/cargoaction.cpp +++ b/src/cargoaction.cpp @@ -120,7 +120,6 @@ bool CargoLoad::operator()(CargoPacket *cp) { CargoPacket *cp_new = this->Preprocess(cp); if (cp_new == nullptr) return false; - cp_new->SetLoadPlace(this->load_place); this->source->RemoveFromCache(cp_new, cp_new->Count()); this->destination->Append(cp_new, VehicleCargoList::MTA_KEEP); return cp_new == cp; @@ -135,7 +134,6 @@ bool CargoReservation::operator()(CargoPacket *cp) { CargoPacket *cp_new = this->Preprocess(cp); if (cp_new == nullptr) return false; - cp_new->SetLoadPlace(this->load_place); this->source->reserved_count += cp_new->Count(); this->source->RemoveFromCache(cp_new, cp_new->Count()); this->destination->Append(cp_new, VehicleCargoList::MTA_LOAD); diff --git a/src/cargoaction.h b/src/cargoaction.h index 7a2876fa9c..c37af8a833 100644 --- a/src/cargoaction.h +++ b/src/cargoaction.h @@ -78,19 +78,17 @@ public: /** Action of loading cargo from a station onto a vehicle. */ class CargoLoad : public CargoMovement { -protected: - TileIndex load_place; ///< TileIndex to be saved in the packets' loaded_at_xy. public: - CargoLoad(StationCargoList *source, VehicleCargoList *destination, uint max_move, TileIndex load_place) : - CargoMovement(source, destination, max_move), load_place(load_place) {} + CargoLoad(StationCargoList *source, VehicleCargoList *destination, uint max_move) : + CargoMovement(source, destination, max_move) {} bool operator()(CargoPacket *cp); }; /** Action of reserving cargo from a station to be loaded onto a vehicle. */ class CargoReservation : public CargoLoad { public: - CargoReservation(StationCargoList *source, VehicleCargoList *destination, uint max_move, TileIndex load_place) : - CargoLoad(source, destination, max_move, load_place) {} + CargoReservation(StationCargoList *source, VehicleCargoList *destination, uint max_move) : + CargoLoad(source, destination, max_move) {} bool operator()(CargoPacket *cp); }; diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index 901f7c6127..679d824b87 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -122,7 +122,6 @@ CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, So days_in_transit(0), feeder_share(0), source_xy(source_xy), - loaded_at_xy(0), source_id(source_id), source(source), source_type(source_type) @@ -137,19 +136,17 @@ CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, So * @param days_in_transit Number of days the cargo has been in transit. * @param source Station the cargo was initially loaded. * @param source_xy Station location the cargo was initially loaded. - * @param loaded_at_xy Location the cargo was loaded last. * @param feeder_share Feeder share the packet has already accumulated. * @param source_type 'Type' of source the packet comes from (for subsidies). * @param source_id Actual source of the packet (for subsidies). * @note We have to zero memory ourselves here because we are using a 'new' * that, in contrary to all other pools, does not memset to 0. */ -CargoPacket::CargoPacket(uint16 count, uint16 days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share, SourceType source_type, SourceID source_id) : +CargoPacket::CargoPacket(uint16 count, uint16 days_in_transit, StationID source, TileIndex source_xy, Money feeder_share, SourceType source_type, SourceID source_id) : count(count), days_in_transit(days_in_transit), feeder_share(feeder_share), source_xy(source_xy), - loaded_at_xy(loaded_at_xy), source_id(source_id), source(source), source_type(source_type) @@ -177,7 +174,7 @@ CargoPacket *CargoPacket::Split(uint new_size) if (!CargoPacket::CanAllocateItem()) return nullptr; Money fs = this->FeederShare(new_size); - CargoPacket *cp_new = new CargoPacket(new_size, this->days_in_transit, this->source, this->source_xy, this->loaded_at_xy, fs, this->source_type, this->source_id); + CargoPacket *cp_new = new CargoPacket(new_size, this->days_in_transit, this->source, this->source_xy, fs, this->source_type, this->source_id); this->feeder_share -= fs; if (this->flags & CPF_HAS_DEFERRED_PAYMENT) { @@ -576,23 +573,6 @@ void VehicleCargoList::AgeCargo() } } -/** - * Sets loaded_at_xy to the current station for all cargo to be transferred. - * This is done when stopping or skipping while the vehicle is unloading. In - * that case the vehicle will get part of its transfer credits early and it may - * get more transfer credits than it's entitled to. - * @param xy New loaded_at_xy for the cargo. - */ -void VehicleCargoList::SetTransferLoadPlace(TileIndex xy) -{ - uint sum = 0; - for (Iterator it = this->packets.begin(); sum < this->action_counts[MTA_TRANSFER]; ++it) { - CargoPacket *cp = *it; - cp->loaded_at_xy = xy; - sum += cp->count; - } -} - /** * Choose action to be performed with the given cargo packet. * @param cp The packet. @@ -1097,13 +1077,12 @@ uint StationCargoList::Truncate(uint max_move, StationCargoAmountMap *cargo_per_ * Reserves cargo for loading onto the vehicle. * @param max_move Maximum amount of cargo to reserve. * @param dest VehicleCargoList to reserve for. - * @param load_place Tile index of the current station. * @param next_station Next station(s) the loading vehicle will visit. * @return Amount of cargo actually reserved. */ -uint StationCargoList::Reserve(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next_station) +uint StationCargoList::Reserve(uint max_move, VehicleCargoList *dest, StationIDStack next_station) { - return this->ShiftCargo(CargoReservation(this, dest, max_move, load_place), next_station, true); + return this->ShiftCargo(CargoReservation(this, dest, max_move), next_station, true); } /** @@ -1111,14 +1090,13 @@ uint StationCargoList::Reserve(uint max_move, VehicleCargoList *dest, TileIndex * Otherwise load cargo from the station. * @param max_move Amount of cargo to load. * @param dest Vehicle cargo list where the cargo resides. - * @param load_place The new loaded_at_xy to be assigned to packets being moved. * @param next_station Next station(s) the loading vehicle will visit. * @return Amount of cargo actually loaded. * @note Vehicles may or may not reserve, depending on their orders. The two * modes of loading are exclusive, though. If cargo is reserved we don't * need to load unreserved cargo. */ -uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next_station) +uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, StationIDStack next_station) { uint move = std::min(dest->ActionCount(VehicleCargoList::MTA_LOAD), max_move); if (move > 0) { @@ -1126,7 +1104,7 @@ uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, TileIndex loa dest->Reassign(move); return move; } else { - return this->ShiftCargo(CargoLoad(this, dest, max_move, load_place), next_station, true); + return this->ShiftCargo(CargoLoad(this, dest, max_move), next_station, true); } } diff --git a/src/cargopacket.h b/src/cargopacket.h index 054ee7bf76..63f85f48bd 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -46,13 +46,6 @@ namespace upstream_sl { void ClearCargoPacketDeferredPayments(); void ChangeOwnershipOfCargoPacketDeferredPayments(Owner old_owner, Owner new_owner); -/** - * To make alignment in the union in CargoPacket a bit easier, create a new type - * that is a StationID, but stored as 32bit. - */ -typedef uint32_t StationID_32bit; -static_assert(sizeof(TileIndex) == sizeof(StationID_32bit)); - /** * Container for cargo from the same location and time. */ @@ -62,10 +55,7 @@ private: uint16 days_in_transit; ///< Amount of days this packet has been in transit. Money feeder_share; ///< Value of feeder pickup to be paid for on delivery of cargo. TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain). - union { - TileIndex loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle. - StationID_32bit next_station; ///< Station where the cargo wants to go next. - }; + StationID next_station; ///< Station where the cargo wants to go next. SourceID source_id; ///< Index of source, INVALID_SOURCE if unknown/invalid. StationID source; ///< The station where the cargo came from first. SourceType source_type; ///< Type of \c source_id. @@ -90,19 +80,13 @@ public: CargoPacket(); CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id); - CargoPacket(uint16 count, uint16 days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share = 0, SourceType source_type = SourceType::Industry, SourceID source_id = INVALID_SOURCE); + CargoPacket(uint16 count, uint16 days_in_transit, StationID source, TileIndex source_xy, Money feeder_share = 0, SourceType source_type = SourceType::Industry, SourceID source_id = INVALID_SOURCE); ~CargoPacket(); CargoPacket *Split(uint new_size); void Merge(CargoPacket *cp); void Reduce(uint count); - /** - * Sets the tile where the packet was loaded last. - * @param load_place Tile where the packet was loaded last. - */ - void SetLoadPlace(TileIndex load_place) { this->loaded_at_xy = load_place; } - /** * Sets the station where the packet is supposed to go next. * @param next_station Next station the packet should go to. @@ -195,15 +179,6 @@ public: return this->source_xy; } - /** - * Gets the coordinates of the cargo's last loading station. - * @return Last loading station's coordinates. - */ - inline TileIndex LoadedAtXY() const - { - return this->loaded_at_xy; - } - /** * Gets the ID of station the cargo wants to go next. * @return Next station for this packets. @@ -452,8 +427,6 @@ public: void InvalidateCache(); - void SetTransferLoadPlace(TileIndex xy); - bool Stage(bool accepted, StationID current_station, StationIDStack next_station, uint8 order_flags, const GoodsEntry *ge, CargoPayment *payment); /** @@ -489,11 +462,10 @@ public: */ static bool AreMergable(const CargoPacket *cp1, const CargoPacket *cp2) { - return cp1->source_xy == cp2->source_xy && + return cp1->source_xy == cp2->source_xy && cp1->days_in_transit == cp2->days_in_transit && cp1->source_type == cp2->source_type && - cp1->source_id == cp2->source_id && - cp1->loaded_at_xy == cp2->loaded_at_xy; + cp1->source_id == cp2->source_id; } }; @@ -599,8 +571,8 @@ public: * amount of cargo to be moved. Second parameter is destination (if * applicable), return value is amount of cargo actually moved. */ - uint Reserve(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next); - uint Load(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next); + uint Reserve(uint max_move, VehicleCargoList *dest, StationIDStack next); + uint Load(uint max_move, VehicleCargoList *dest, StationIDStack next); uint Truncate(uint max_move = UINT_MAX, StationCargoAmountMap *cargo_per_source = nullptr); uint Reroute(uint max_move, StationCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge); uint RerouteFromSource(uint max_move, StationCargoList *dest, StationID source, StationID avoid, StationID avoid2, const GoodsEntry *ge); diff --git a/src/economy.cpp b/src/economy.cpp index 55c5d5c834..5292c23b29 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1751,7 +1751,7 @@ struct FinalizeRefitAction { if (this->do_reserve || (cargo_type_loading == nullptr || (cargo_type_loading->current_order.GetCargoLoadTypeRaw(v->cargo_type) & OLFB_FULL_LOAD))) { this->st->goods[v->cargo_type].CreateData().cargo.Reserve(v->cargo_cap - v->cargo.RemainingCount(), - &v->cargo, st->xy, this->next_station.Get(v->cargo_type)); + &v->cargo, this->next_station.Get(v->cargo_type)); } this->consist_capleft[v->cargo_type] += v->cargo_cap - v->cargo.RemainingCount(); return true; @@ -1856,7 +1856,7 @@ struct ReserveCargoAction { } if (v->cargo_cap > v->cargo.RemainingCount() && MayLoadUnderExclusiveRights(st, v)) { st->goods[v->cargo_type].CreateData().cargo.Reserve(v->cargo_cap - v->cargo.RemainingCount(), - &v->cargo, st->xy, next_station.Get(v->cargo_type)); + &v->cargo, next_station.Get(v->cargo_type)); } return true; @@ -2196,7 +2196,7 @@ static void LoadUnloadVehicle(Vehicle *front) if (v->cargo.StoredCount() == 0) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO); if (_settings_game.order.gradual_loading) cap_left = std::min(cap_left, GetLoadAmount(v)); - uint loaded = ged->cargo.Load(cap_left, &v->cargo, st->xy, next_station.Get(v->cargo_type)); + uint loaded = ged->cargo.Load(cap_left, &v->cargo, next_station.Get(v->cargo_type)); if (v->cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) { /* Remember if there are reservations left so that we don't stop * loading before they're loaded. */ diff --git a/src/saveload/cargopacket_sl.cpp b/src/saveload/cargopacket_sl.cpp index 2f5b88f939..3c60e6ae0a 100644 --- a/src/saveload/cargopacket_sl.cpp +++ b/src/saveload/cargopacket_sl.cpp @@ -29,7 +29,6 @@ SaveLoadTable GetCargoPacketDesc() static const SaveLoad _cargopacket_desc[] = { SLE_VAR(CargoPacket, source, SLE_UINT16), SLE_VAR(CargoPacket, source_xy, SLE_UINT32), - SLE_VAR(CargoPacket, loaded_at_xy, SLE_UINT32), SLE_VAR(CargoPacket, count, SLE_UINT16), SLE_CONDVAR(CargoPacket, days_in_transit, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_MORE_CARGO_AGE), SLE_CONDVAR(CargoPacket, days_in_transit, SLE_UINT16, SLV_MORE_CARGO_AGE, SLV_PERIODS_IN_TRANSIT_RENAME), diff --git a/src/saveload/compat/cargopacket_sl_compat.h b/src/saveload/compat/cargopacket_sl_compat.h index 1d98b2b4e3..7ca5fa3389 100644 --- a/src/saveload/compat/cargopacket_sl_compat.h +++ b/src/saveload/compat/cargopacket_sl_compat.h @@ -18,7 +18,7 @@ namespace upstream_sl { const SaveLoadCompat _cargopacket_sl_compat[] = { SLC_VAR("source"), SLC_VAR("source_xy"), - SLC_VAR("loaded_at_xy"), + SLC_NULL(4, SL_MIN_VERSION, SLV_REMOVE_LOADED_AT_XY), SLC_VAR("count"), SLC_VAR("days_in_transit"), SLC_VAR("feeder_share"), diff --git a/src/saveload/compat/vehicle_sl_compat.h b/src/saveload/compat/vehicle_sl_compat.h index 0fd19ecc0e..d5f22e442a 100644 --- a/src/saveload/compat/vehicle_sl_compat.h +++ b/src/saveload/compat/vehicle_sl_compat.h @@ -84,7 +84,7 @@ const SaveLoadCompat _vehicle_common_sl_compat[] = { SLC_VAR("profit_this_year"), SLC_VAR("profit_last_year"), SLC_VAR("cargo_feeder_share"), - SLC_VAR("cargo_loaded_at_xy"), + SLC_NULL(4, SLV_51, SLV_68), SLC_VAR("value"), SLC_VAR("random_bits"), SLC_VAR("waiting_triggers"), diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index 2c62782921..a92f277b0e 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -305,7 +305,7 @@ public: assert(CargoPacket::CanAllocateItem()); /* Don't construct the packet with station here, because that'll fail with old savegames */ - CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, source, _cargo_source_xy, _cargo_source_xy, _cargo_feeder_share); + CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, source, _cargo_source_xy, _cargo_feeder_share); ge->data->cargo.Append(cp, INVALID_STATION); SB(ge->status, GoodsEntry::GES_RATING, 1, 1); } diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index 386946032f..166a6aace7 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -44,7 +44,6 @@ static uint32 _cargo_source_xy; static uint16 _cargo_count; static uint16 _cargo_paid_for; static Money _cargo_feeder_share; -static uint32 _cargo_loaded_at_xy; class SlVehicleCommon : public DefaultSaveLoadHandler { public: @@ -166,7 +165,6 @@ public: SLE_CONDVAR(Vehicle, profit_last_year, SLE_INT64, SLV_65, SL_MAX_VERSION), SLEG_CONDVAR("cargo_feeder_share", _cargo_feeder_share, SLE_FILE_I32 | SLE_VAR_I64, SLV_51, SLV_65), SLEG_CONDVAR("cargo_feeder_share", _cargo_feeder_share, SLE_INT64, SLV_65, SLV_68), - SLEG_CONDVAR("cargo_loaded_at_xy", _cargo_loaded_at_xy, SLE_UINT32, SLV_51, SLV_68), SLE_CONDVAR(Vehicle, value, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_65), SLE_CONDVAR(Vehicle, value, SLE_INT64, SLV_65, SL_MAX_VERSION), @@ -535,7 +533,7 @@ struct VEHSChunkHandler : ChunkHandler { if (_cargo_count != 0 && IsCompanyBuildableVehicleType(v) && CargoPacket::CanAllocateItem()) { /* Don't construct the packet with station here, because that'll fail with old savegames */ - CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_days, _cargo_source, _cargo_source_xy, _cargo_loaded_at_xy, _cargo_feeder_share); + CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_days, _cargo_source, _cargo_source_xy, _cargo_feeder_share); v->cargo.Append(cp); } diff --git a/src/sl/cargopacket_sl.cpp b/src/sl/cargopacket_sl.cpp index 01267eff28..6424371f08 100644 --- a/src/sl/cargopacket_sl.cpp +++ b/src/sl/cargopacket_sl.cpp @@ -36,7 +36,6 @@ extern btree::btree_map _cargo_packet_deferred_payments; for (VehicleCargoList::ConstIterator it(packets->begin()); it != packets->end(); it++) { CargoPacket *cp = *it; cp->source_xy = Station::IsValidID(cp->source) ? Station::Get(cp->source)->xy : v->tile; - cp->loaded_at_xy = cp->source_xy; } } @@ -54,7 +53,6 @@ extern btree::btree_map _cargo_packet_deferred_payments; for (StationCargoList::ConstIterator it(packets->begin()); it != packets->end(); it++) { CargoPacket *cp = *it; cp->source_xy = Station::IsValidID(cp->source) ? Station::Get(cp->source)->xy : st->xy; - cp->loaded_at_xy = cp->source_xy; } } } @@ -116,7 +114,7 @@ SaveLoadTable GetCargoPacketDesc() static const SaveLoad _cargopacket_desc[] = { SLE_VAR(CargoPacket, source, SLE_UINT16), SLE_VAR(CargoPacket, source_xy, SLE_UINT32), - SLE_VAR(CargoPacket, loaded_at_xy, SLE_UINT32), + SLE_VAR(CargoPacket, next_station, SLE_FILE_U32 | SLE_VAR_U16), SLE_VAR(CargoPacket, count, SLE_UINT16), SLE_CONDVAR_X(CargoPacket, days_in_transit, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_MORE_CARGO_AGE, 0, 0)), SLE_CONDVAR_X(CargoPacket, days_in_transit, SLE_UINT16, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_MORE_CARGO_AGE)), diff --git a/src/sl/oldloader_sl.cpp b/src/sl/oldloader_sl.cpp index cb072811fb..8e2d817e64 100644 --- a/src/sl/oldloader_sl.cpp +++ b/src/sl/oldloader_sl.cpp @@ -1353,7 +1353,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num) if (_cargo_count != 0 && CargoPacket::CanAllocateItem()) { StationID source = (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source; TileIndex source_xy = (source != INVALID_STATION) ? Station::Get(source)->xy : 0; - v->cargo.Append(new CargoPacket(_cargo_count, _cargo_days, source, source_xy, source_xy)); + v->cargo.Append(new CargoPacket(_cargo_count, _cargo_days, source, source_xy)); } } diff --git a/src/sl/saveload_common.h b/src/sl/saveload_common.h index 77241c0cf3..b23b366579 100644 --- a/src/sl/saveload_common.h +++ b/src/sl/saveload_common.h @@ -371,6 +371,7 @@ enum SaveLoadVersion : uint16 { SLV_INDUSTRY_CARGO_REORGANISE, ///< 315 PR#10853 Industry accepts/produced data reorganised. SLV_PERIODS_IN_TRANSIT_RENAME, ///< 316 PR#11112 Rename days in transit to (cargo) periods in transit. SLV_NEWGRF_LAST_SERVICE, ///< 317 PR#11124 Added stable date_of_last_service to avoid NewGRF trouble. + SLV_REMOVE_LOADED_AT_XY, ///< 318 PR#11276 Remove loaded_at_xy variable from CargoPacket. SL_MAX_VERSION, ///< Highest possible saveload version diff --git a/src/sl/station_sl.cpp b/src/sl/station_sl.cpp index 5816191f23..ddd93a4f6e 100644 --- a/src/sl/station_sl.cpp +++ b/src/sl/station_sl.cpp @@ -374,7 +374,7 @@ static void Load_STNS() assert(CargoPacket::CanAllocateItem()); /* Don't construct the packet with station here, because that'll fail with old savegames */ - CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, source, _cargo_source_xy, _cargo_source_xy, _cargo_feeder_share); + CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, source, _cargo_source_xy, _cargo_feeder_share); ge->CreateData().cargo.Append(cp, INVALID_STATION); SB(ge->status, GoodsEntry::GES_RATING, 1, 1); } diff --git a/src/sl/vehicle_sl.cpp b/src/sl/vehicle_sl.cpp index cd3ce69399..294ac9b7cf 100644 --- a/src/sl/vehicle_sl.cpp +++ b/src/sl/vehicle_sl.cpp @@ -641,7 +641,6 @@ static uint32 _cargo_source_xy; static uint16 _cargo_count; static uint16 _cargo_paid_for; static Money _cargo_feeder_share; -static uint32 _cargo_loaded_at_xy; CargoPacketList _cpp_packets; std::map _veh_cpp_packets; static std::vector _path_td; @@ -789,7 +788,7 @@ SaveLoadTable GetVehicleDescription(VehicleType vt) SLE_CONDVAR_X(Vehicle,profit_lifetime, SLE_INT64, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_VEH_LIFETIME_PROFIT)), SLEG_CONDVAR( _cargo_feeder_share, SLE_FILE_I32 | SLE_VAR_I64, SLV_51, SLV_65), SLEG_CONDVAR( _cargo_feeder_share, SLE_INT64, SLV_65, SLV_68), - SLEG_CONDVAR( _cargo_loaded_at_xy, SLE_UINT32, SLV_51, SLV_68), + SLE_CONDNULL(4 , SLV_51, SLV_68), // _cargo_loaded_at_xy SLE_CONDVAR(Vehicle, value, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_65), SLE_CONDVAR(Vehicle, value, SLE_INT64, SLV_65, SL_MAX_VERSION), SLE_CONDNULL_X(8, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_VEHICLE_REPAIR_COST, 1, 1)), @@ -1096,7 +1095,7 @@ void Load_VEHS() if (_cargo_count != 0 && IsCompanyBuildableVehicleType(v) && CargoPacket::CanAllocateItem()) { /* Don't construct the packet with station here, because that'll fail with old savegames */ - CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_days, _cargo_source, _cargo_source_xy, _cargo_loaded_at_xy, _cargo_feeder_share); + CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_days, _cargo_source, _cargo_source_xy, _cargo_feeder_share); v->cargo.Append(cp); } diff --git a/src/vehicle.cpp b/src/vehicle.cpp index ce118ee8e0..8655e03c5c 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -3386,7 +3386,6 @@ void Vehicle::CancelReservation(StationID next, Station *st) if (cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) { DEBUG(misc, 1, "cancelling cargo reservation"); cargo.Return(UINT_MAX, &st->goods[v->cargo_type].CreateData().cargo, next); - cargo.SetTransferLoadPlace(st->xy); } cargo.KeepAll(); }