Codechange: simplify the type of loaded_at_xy / next_station (#11182)

It was TileOrStationID, most likely to make sure both types in
the union are identical. But as TileIndex is a StrongTypeDef
that becomes a bit weird. So instead, still make sure they are
of equal size, but define their individual types better.

(cherry picked from commit c9c9cfa4fd)
This commit is contained in:
Patric Stout
2023-08-11 14:55:55 +02:00
committed by Jonathan G Rennison
parent e0e4d7c07e
commit d17c949c22
2 changed files with 13 additions and 8 deletions

View File

@@ -745,7 +745,7 @@ void VehicleCargoList::InvalidateCache()
* @return Amount of cargo actually reassigned.
*/
template<VehicleCargoList::MoveToAction Tfrom, VehicleCargoList::MoveToAction Tto>
uint VehicleCargoList::Reassign(uint max_move, TileOrStationID)
uint VehicleCargoList::Reassign(uint max_move, StationID)
{
static_assert(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER);
static_assert(Tfrom - Tto == 1 || Tto - Tfrom == 1);
@@ -763,7 +763,7 @@ uint VehicleCargoList::Reassign(uint max_move, TileOrStationID)
* @return Amount of cargo actually reassigned.
*/
template<>
uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(uint max_move, TileOrStationID next_station)
uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(uint max_move, StationID next_station)
{
max_move = std::min(this->action_counts[MTA_DELIVER], max_move);
@@ -1161,4 +1161,4 @@ uint StationCargoList::RerouteFromSource(uint max_move, StationCargoList *dest,
*/
template class CargoList<VehicleCargoList, CargoPacketList>;
template class CargoList<StationCargoList, StationCargoPacketMap>;
template uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_KEEP>(uint, TileOrStationID);
template uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_KEEP>(uint, StationID);