(svn r10654) [NewGRF_ports] -Change: Can now load and save newgrf airports. Graphics correctly reloaded after save.
--- a/src/saveload.cpp Sun Jul 22 21:24:42 2007 +0000
+++ b/src/saveload.cpp Sun Jul 22 22:28:46 2007 +0000
@@ -30,7 +30,7 @@
#include <setjmp.h>
#include <list>
-extern const uint16 SAVEGAME_VERSION = 72;
+extern const uint16 SAVEGAME_VERSION = 73;
uint16 _sl_version; ///< the major savegame version identifier
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
--- a/src/station_cmd.cpp Sun Jul 22 21:24:42 2007 +0000
+++ b/src/station_cmd.cpp Sun Jul 22 22:28:46 2007 +0000
@@ -2877,6 +2877,12 @@
st->speclist[i].spec = GetCustomStationSpecByGrf(st->speclist[i].grfid, st->speclist[i].localidx);
}
+ for (uint i = 0; i < st->num_fsmportsspecs; i++) {
+ if (st->fsmportsspeclist[i].grfid == 0) continue;
+
+ st->fsmportsspeclist[i].spec = GetCustomFSMportsSpecByGrf(st->fsmportsspeclist[i].grfid, st->fsmportsspeclist[i].localidx);
+ }
+
for (CargoID c = 0; c < NUM_CARGO; c++) st->goods[c].cargo.InvalidateCache();
}
}
@@ -2965,6 +2971,7 @@
SLE_CONDVAR(Station, random_bits, SLE_UINT16, 27, SL_MAX_VERSION),
SLE_CONDVAR(Station, waiting_triggers, SLE_UINT8, 27, SL_MAX_VERSION),
SLE_CONDVAR(Station, num_specs, SLE_UINT8, 27, SL_MAX_VERSION),
+ SLE_CONDVAR(Station, num_fsmportsspecs, SLE_UINT8, 73, SL_MAX_VERSION),
SLE_CONDLST(Station, loading_vehicles, REF_VEHICLE, 57, SL_MAX_VERSION),
@@ -3006,6 +3013,13 @@
SLE_END()
};
+static const SaveLoad _fsmports_speclist_desc[] = {
+ SLE_CONDVAR(FSMportsSpecList, grfid, SLE_UINT32, 73, SL_MAX_VERSION),
+ SLE_CONDVAR(FSMportsSpecList, localidx, SLE_UINT8, 73, SL_MAX_VERSION),
+
+ SLE_END()
+};
+
static void SaveLoad_STNS(Station *st)
{
@@ -3044,6 +3058,14 @@
SlObject(&st->speclist[i], _station_speclist_desc);
}
}
+
+ if (st->num_fsmportsspecs != 0) {
+ /* Allocate fsmspeclist memory when loading a game */
+ if (st->fsmportsspeclist == NULL) st->fsmportsspeclist = CallocT<FSMportsSpecList>(st->num_fsmportsspecs);
+ for (uint i = 0; i < st->num_fsmportsspecs; i++) {
+ SlObject(&st->fsmportsspeclist[i], _fsmports_speclist_desc);
+ }
+ }
}
static void Save_STNS()