summaryrefslogtreecommitdiff
path: root/src/saveload/station_sl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/saveload/station_sl.cpp')
-rw-r--r--src/saveload/station_sl.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp
index 715ded17a..d85a5728b 100644
--- a/src/saveload/station_sl.cpp
+++ b/src/saveload/station_sl.cpp
@@ -118,10 +118,9 @@ static const SaveLoad _station_speclist_desc[] = {
SLE_END()
};
-
-void SaveLoad_STNS(Station *st)
+const SaveLoad *GetGoodsDesc()
{
- static const SaveLoad _goods_desc[] = {
+ static const SaveLoad goods_desc[] = {
SLEG_CONDVAR( _waiting_acceptance, SLE_UINT16, 0, 67),
SLE_CONDVAR(GoodsEntry, acceptance_pickup, SLE_UINT8, 68, SL_MAX_VERSION),
SLE_CONDNULL(2, 51, 67),
@@ -140,7 +139,12 @@ void SaveLoad_STNS(Station *st)
SLE_END()
};
+ return goods_desc;
+}
+
+static void SaveLoad_STNS(Station *st)
+{
SlObject(st, _station_desc);
_waiting_acceptance = 0;
@@ -148,7 +152,7 @@ void SaveLoad_STNS(Station *st)
uint num_cargo = CheckSavegameVersion(55) ? 12 : NUM_CARGO;
for (CargoID i = 0; i < num_cargo; i++) {
GoodsEntry *ge = &st->goods[i];
- SlObject(ge, _goods_desc);
+ SlObject(ge, GetGoodsDesc());
if (CheckSavegameVersion(68)) {
SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
if (GB(_waiting_acceptance, 0, 12) != 0) {
@@ -197,6 +201,21 @@ static void Load_STNS()
}
}
+void Ptrs_STNS()
+{
+ Station *st;
+ FOR_ALL_STATIONS(st) {
+ if (!CheckSavegameVersion(68)) {
+ for (CargoID i = 0; i < NUM_CARGO; i++) {
+ GoodsEntry *ge = &st->goods[i];
+ SlObject(ge, GetGoodsDesc());
+ }
+ }
+ SlObject(st, _station_desc);
+ }
+}
+
+
static void Save_ROADSTOP()
{
RoadStop *rs;
@@ -218,7 +237,15 @@ static void Load_ROADSTOP()
}
}
+static void Ptrs_ROADSTOP()
+{
+ RoadStop *rs;
+ FOR_ALL_ROADSTOPS(rs) {
+ SlObject(rs, _roadstop_desc);
+ }
+}
+
extern const ChunkHandler _station_chunk_handlers[] = {
- { 'STNS', Save_STNS, Load_STNS, CH_ARRAY },
- { 'ROAD', Save_ROADSTOP, Load_ROADSTOP, CH_ARRAY | CH_LAST},
+ { 'STNS', Save_STNS, Load_STNS, Ptrs_STNS, CH_ARRAY },
+ { 'ROAD', Save_ROADSTOP, Load_ROADSTOP, Ptrs_ROADSTOP, CH_ARRAY | CH_LAST},
};