(svn r25010) -Codechange: Add general framework for cargo actions, i.e. loading, transfering, delivering and such, to contain this logic in a single place instead of spread around (fonsinchen)

This commit is contained in:
rubidium
2013-02-17 14:36:40 +00:00
parent 71bbc130fc
commit d6e2a8aa56
9 changed files with 336 additions and 22 deletions

View File

@@ -219,6 +219,12 @@ protected:
void RemoveFromCache(const CargoPacket *cp, uint count);
template<class Taction>
void ShiftCargo(Taction action);
template<class Taction>
void PopCargo(Taction action);
static bool TryMerge(CargoPacket *cp, CargoPacket *icp);
public:
@@ -303,6 +309,12 @@ public:
/** The vehicles have a cargo list (and we want that saved). */
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt);
friend class CargoShift;
friend class CargoTransfer;
friend class CargoDelivery;
template<class Tsource>
friend class CargoRemoval;
/**
* Returns total sum of the feeder share for all packets.
* @return The before mentioned number.
@@ -343,6 +355,11 @@ public:
/** The stations, via GoodsEntry, have a CargoList. */
friend const struct SaveLoad *GetGoodsDesc();
friend class CargoLoad;
friend class CargoTransfer;
template<class Tsource>
friend class CargoRemoval;
/**
* Are two the two CargoPackets mergeable in the context of
* a list of CargoPackets for a Vehicle?