summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-02-09 18:56:40 +0000
committersmatz <smatz@openttd.org>2011-02-09 18:56:40 +0000
commit69789f3008968de7d0740792cb26a179a3b30436 (patch)
tree852218680e9fcee1035d5fe6985121fd275a00d6 /src
parentfbfb0ffbf24b7ea2630b4b3caee63d09964da75b (diff)
downloadopenttd-69789f3008968de7d0740792cb26a179a3b30436.tar.xz
(svn r22042) -Fix: when loading a TTO/TTD savegame, verify we can allocate a CargoPacket before actually trying to do so
Diffstat (limited to 'src')
-rw-r--r--src/saveload/oldloader_sl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 724249b72..362df6b63 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -710,7 +710,7 @@ static bool LoadOldGood(LoadgameState *ls, int num)
SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
SB(ge->acceptance_pickup, GoodsEntry::PICKUP, 1, _cargo_source != 0xFF);
- if (GB(_waiting_acceptance, 0, 12) != 0) {
+ if (GB(_waiting_acceptance, 0, 12) != 0 && CargoPacket::CanAllocateItem()) {
ge->cargo.Append(new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, 0, 0));
}
@@ -1347,7 +1347,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
v->next = (Vehicle *)(size_t)_old_next_ptr;
- if (_cargo_count != 0) {
+ if (_cargo_count != 0 && CargoPacket::CanAllocateItem()) {
StationID source = (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
TileIndex source_xy = (source != INVALID_STATION) ? Station::Get(source)->xy : 0;
v->cargo.Append(new CargoPacket(_cargo_count, _cargo_days, source, source_xy, source_xy));