mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: remove parameter from VehicleCargoList::Reassign that is always INVALID_STATION
This commit is contained in:
parent
6643c010bd
commit
a0f6983be4
|
@ -533,7 +533,7 @@ void VehicleCargoList::InvalidateCache()
|
||||||
* @return Amount of cargo actually reassigned.
|
* @return Amount of cargo actually reassigned.
|
||||||
*/
|
*/
|
||||||
template<VehicleCargoList::MoveToAction Tfrom, VehicleCargoList::MoveToAction Tto>
|
template<VehicleCargoList::MoveToAction Tfrom, VehicleCargoList::MoveToAction Tto>
|
||||||
uint VehicleCargoList::Reassign(uint max_move, StationID)
|
uint VehicleCargoList::Reassign(uint max_move)
|
||||||
{
|
{
|
||||||
static_assert(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER);
|
static_assert(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER);
|
||||||
static_assert(Tfrom - Tto == 1 || Tto - Tfrom == 1);
|
static_assert(Tfrom - Tto == 1 || Tto - Tfrom == 1);
|
||||||
|
@ -547,11 +547,10 @@ uint VehicleCargoList::Reassign(uint max_move, StationID)
|
||||||
* Reassign cargo from MTA_DELIVER to MTA_TRANSFER and take care of the next
|
* Reassign cargo from MTA_DELIVER to MTA_TRANSFER and take care of the next
|
||||||
* station the cargo wants to visit.
|
* station the cargo wants to visit.
|
||||||
* @param max_move Maximum amount of cargo to reassign.
|
* @param max_move Maximum amount of cargo to reassign.
|
||||||
* @param next_station Station to record as next hop in the reassigned packets.
|
|
||||||
* @return Amount of cargo actually reassigned.
|
* @return Amount of cargo actually reassigned.
|
||||||
*/
|
*/
|
||||||
template<>
|
template<>
|
||||||
uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(uint max_move, StationID next_station)
|
uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(uint max_move)
|
||||||
{
|
{
|
||||||
max_move = std::min(this->action_counts[MTA_DELIVER], max_move);
|
max_move = std::min(this->action_counts[MTA_DELIVER], max_move);
|
||||||
|
|
||||||
|
@ -565,7 +564,7 @@ uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList:
|
||||||
sum -= cp_split->Count();
|
sum -= cp_split->Count();
|
||||||
this->packets.insert(it, cp_split);
|
this->packets.insert(it, cp_split);
|
||||||
}
|
}
|
||||||
cp->next_station = next_station;
|
cp->next_station = INVALID_STATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->action_counts[MTA_DELIVER] -= max_move;
|
this->action_counts[MTA_DELIVER] -= max_move;
|
||||||
|
@ -844,4 +843,4 @@ uint StationCargoList::Reroute(uint max_move, StationCargoList *dest, StationID
|
||||||
*/
|
*/
|
||||||
template class CargoList<VehicleCargoList, CargoPacketList>;
|
template class CargoList<VehicleCargoList, CargoPacketList>;
|
||||||
template class CargoList<StationCargoList, StationCargoPacketMap>;
|
template class CargoList<StationCargoList, StationCargoPacketMap>;
|
||||||
template uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_KEEP>(uint, StationID);
|
template uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_KEEP>(uint);
|
||||||
|
|
|
@ -403,7 +403,7 @@ public:
|
||||||
* applicable), return value is amount of cargo actually moved. */
|
* applicable), return value is amount of cargo actually moved. */
|
||||||
|
|
||||||
template<MoveToAction Tfrom, MoveToAction Tto>
|
template<MoveToAction Tfrom, MoveToAction Tto>
|
||||||
uint Reassign(uint max_move, StationID update = INVALID_STATION);
|
uint Reassign(uint max_move);
|
||||||
uint Return(uint max_move, StationCargoList *dest, StationID next_station);
|
uint Return(uint max_move, StationCargoList *dest, StationID next_station);
|
||||||
uint Unload(uint max_move, StationCargoList *dest, CargoPayment *payment);
|
uint Unload(uint max_move, StationCargoList *dest, CargoPayment *payment);
|
||||||
uint Shift(uint max_move, VehicleCargoList *dest);
|
uint Shift(uint max_move, VehicleCargoList *dest);
|
||||||
|
|
|
@ -1689,7 +1689,7 @@ static void LoadUnloadVehicle(Vehicle *front)
|
||||||
if (front->current_order.GetUnloadType() & (OUFB_TRANSFER | OUFB_UNLOAD)) {
|
if (front->current_order.GetUnloadType() & (OUFB_TRANSFER | OUFB_UNLOAD)) {
|
||||||
/* Transfer instead of delivering. */
|
/* Transfer instead of delivering. */
|
||||||
v->cargo.Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(
|
v->cargo.Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(
|
||||||
v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER), INVALID_STATION);
|
v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER));
|
||||||
} else {
|
} else {
|
||||||
uint new_remaining = v->cargo.RemainingCount() + v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER);
|
uint new_remaining = v->cargo.RemainingCount() + v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER);
|
||||||
if (v->cargo_cap < new_remaining) {
|
if (v->cargo_cap < new_remaining) {
|
||||||
|
|
Loading…
Reference in New Issue