summaryrefslogtreecommitdiff
path: root/src/cargopacket.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-10-20 22:24:34 +0000
committerrubidium <rubidium@openttd.org>2009-10-20 22:24:34 +0000
commit69b8e8e755959af5731e2caf05a421ef949a1bb6 (patch)
tree3491370b3745e950e35a7aa6fbaa64b970752009 /src/cargopacket.h
parent79906f7ffef0543a10ffa530fbb95431a0fbe838 (diff)
downloadopenttd-69b8e8e755959af5731e2caf05a421ef949a1bb6.tar.xz
(svn r17836) -Codechange: split the CargoPacket constructor for creating 'real' new CargoPackets and saveload. For saveload we do not need to set anything except two variables (the rest is always overwritten by the load), for new 'real' cargo also pass the source_xy; dereferencing st before calling is easier than resolving st->index back to st and then dereferencing. Also don't set loaded_at_xy because that is of no importance when not loaded in a vehicle.
Diffstat (limited to 'src/cargopacket.h')
-rw-r--r--src/cargopacket.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cargopacket.h b/src/cargopacket.h
index 13970e18e..17528e516 100644
--- a/src/cargopacket.h
+++ b/src/cargopacket.h
@@ -57,14 +57,20 @@ public:
static const uint16 MAX_COUNT = UINT16_MAX;
/**
+ * Create a new packet for savegame loading.
+ */
+ CargoPacket();
+
+ /**
* Creates a new cargo packet
- * @param source the source of the packet
+ * @param source the source station of the packet
+ * @param source_xy the source location of the packet
* @param count the number of cargo entities to put in this packet
* @param source_type the 'type' of source the packet comes from (for subsidies)
* @param source_id the actual source of the packet (for subsidies)
- * @pre count != 0 || source == INVALID_STATION
+ * @pre count != 0
*/
- CargoPacket(StationID source = INVALID_STATION, uint16 count = 0, SourceType source_type = ST_INDUSTRY, SourceID source_id = INVALID_SOURCE);
+ CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id);
/**
* Creates a new cargo packet. Initializes the fields that cannot be changed later.