summaryrefslogtreecommitdiff
path: root/src/cargopacket.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-10-18 17:52:44 +0000
committerrubidium <rubidium@openttd.org>2009-10-18 17:52:44 +0000
commitf11cebfe9b09bf5cf815d37ca6a19212755251ab (patch)
tree664ac4f2e4f2d026dd8612509cdc545e1a0f9e1b /src/cargopacket.cpp
parent4ad30fecdee33708bc95a8e790b4c85814c36317 (diff)
downloadopenttd-f11cebfe9b09bf5cf815d37ca6a19212755251ab.tar.xz
(svn r17807) -Codechange: move all 'updates' just after the 'load' constructor of CargoPackets to the constructor call itself
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r--src/cargopacket.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp
index e9b3f5064..12e7dde29 100644
--- a/src/cargopacket.cpp
+++ b/src/cargopacket.cpp
@@ -40,11 +40,14 @@ CargoPacket::CargoPacket(StationID source, uint16 count, SourceType source_type,
}
}
-CargoPacket::CargoPacket(uint16 count, byte days_in_transit, Money feeder_share, SourceType source_type, SourceID source_id) :
+CargoPacket::CargoPacket(uint16 count, byte days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share, SourceType source_type, SourceID source_id) :
feeder_share(feeder_share),
count(count),
days_in_transit(days_in_transit),
- source_id(source_id)
+ source_id(source_id),
+ source(source),
+ source_xy(source_xy),
+ loaded_at_xy(loaded_at_xy)
{
this->source_type = source_type;
}
@@ -224,12 +227,7 @@ bool CargoList<Tinst>::MoveTo(Tother_inst *dest, uint max_move, CargoList::MoveT
Money fs = cp->feeder_share * max_move / static_cast<uint>(cp->count);
cp->feeder_share -= fs;
- CargoPacket *cp_new = new CargoPacket(max_move, cp->days_in_transit, fs, cp->source_type, cp->source_id);
-
- cp_new->source = cp->source;
- cp_new->source_xy = cp->source_xy;
- cp_new->loaded_at_xy = (mta == MTA_CARGO_LOAD) ? data : cp->loaded_at_xy;
-
+ CargoPacket *cp_new = new CargoPacket(max_move, cp->days_in_transit, cp->source, cp->source_xy, (mta == MTA_CARGO_LOAD) ? data : cp->loaded_at_xy, fs, cp->source_type, cp->source_id);
this->RemoveFromCache(cp_new); // this reflects the changes in cp.
if (mta == MTA_TRANSFER) {