diff options
author | fonsinchen <fonsinchen@openttd.org> | 2013-06-23 08:28:53 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2013-06-23 08:28:53 +0000 |
commit | 3dd811e1794bc9247d5ace0bad7ade5998a7b54f (patch) | |
tree | 61c77b60ec755ead4784c34bc8dcc0310e9b786e /src/cargoaction.h | |
parent | 57e5a95b6fc9cc0882c08dea75d4d5d35c96d45a (diff) | |
download | openttd-3dd811e1794bc9247d5ace0bad7ade5998a7b54f.tar.xz |
(svn r25434) -Fix: reroute cargo staged for unloading if a link breaks
Diffstat (limited to 'src/cargoaction.h')
-rw-r--r-- | src/cargoaction.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/cargoaction.h b/src/cargoaction.h index b6879fb76..c305fcb29 100644 --- a/src/cargoaction.h +++ b/src/cargoaction.h @@ -112,15 +112,34 @@ public: bool operator()(CargoPacket *cp); }; -/** Action of rerouting cargo between different station cargo lists and/or next hops. */ -class CargoReroute : public CargoMovement<StationCargoList, StationCargoList> { +/** Action of rerouting cargo between different cargo lists and/or next hops. */ +template<class Tlist> +class CargoReroute : public CargoMovement<Tlist, Tlist> { protected: StationID avoid; StationID avoid2; const GoodsEntry *ge; public: - CargoReroute(StationCargoList *source, StationCargoList *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge) : - CargoMovement<StationCargoList, StationCargoList>(source, dest, max_move), avoid(avoid), avoid2(avoid2), ge(ge) {} + CargoReroute(Tlist *source, Tlist *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge) : + CargoMovement<Tlist, Tlist>(source, dest, max_move), avoid(avoid), avoid2(avoid2), ge(ge) {} +}; + +/** Action of rerouting cargo in a station. */ +class StationCargoReroute : public CargoReroute<StationCargoList> { +public: + StationCargoReroute(StationCargoList *source, StationCargoList *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge) : + CargoReroute<StationCargoList>(source, dest, max_move, avoid, avoid2, ge) {} + bool operator()(CargoPacket *cp); +}; + +/** Action of rerouting cargo staged for transfer in a vehicle. */ +class VehicleCargoReroute : public CargoReroute<VehicleCargoList> { +public: + VehicleCargoReroute(VehicleCargoList *source, VehicleCargoList *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge) : + CargoReroute<VehicleCargoList>(source, dest, max_move, avoid, avoid2, ge) + { + assert(this->max_move <= source->ActionCount(VehicleCargoList::MTA_TRANSFER)); + } bool operator()(CargoPacket *cp); }; |