summaryrefslogtreecommitdiff
path: root/src/cargopacket.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-02-17 14:36:40 +0000
committerrubidium <rubidium@openttd.org>2013-02-17 14:36:40 +0000
commitd6e2a8aa56337af68f2960cf404edf0ac03f405b (patch)
treeaccb17985ebc03652d3c7b42b0dc8c038943a4c3 /src/cargopacket.h
parent71bbc130fc3bde400bcf2d46e0d57d974acc83aa (diff)
downloadopenttd-d6e2a8aa56337af68f2960cf404edf0ac03f405b.tar.xz
(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)
Diffstat (limited to 'src/cargopacket.h')
-rw-r--r--src/cargopacket.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cargopacket.h b/src/cargopacket.h
index c23df8800..ab0d45f47 100644
--- a/src/cargopacket.h
+++ b/src/cargopacket.h
@@ -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?