diff options
author | yexo <yexo@openttd.org> | 2010-08-05 12:06:13 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-08-05 12:06:13 +0000 |
commit | 2e6713ce956d42f55f0f6f34fe12ec8459dc0ab4 (patch) | |
tree | 79f6f1582cab37d6fd7ae03b8095147d85fb846d | |
parent | 00902294b3077c163df1917121c5bb9a7b48e179 (diff) | |
download | openttd-2e6713ce956d42f55f0f6f34fe12ec8459dc0ab4.tar.xz |
(svn r20374) -Codechange: add persistant storage for airports
-rw-r--r-- | src/newgrf_airport.cpp | 5 | ||||
-rw-r--r-- | src/saveload/station_sl.cpp | 1 | ||||
-rw-r--r-- | src/station_base.h | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index d077ae14f..23e6dff3d 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -263,6 +263,9 @@ uint32 AirportGetVariable(const ResolverObject *object, byte variable, byte para } switch (variable) { + /* Get a variable from the persistent storage */ + case 0x7C: return st->airport.psa.Get(parameter); + case 0xF0: return st->facilities; case 0xFA: return Clamp(st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535); } @@ -304,7 +307,7 @@ static void NewAirportResolver(ResolverObject *res, TileIndex tile, Station *st, res->GetVariable = AirportGetVariable; res->ResolveReal = AirportResolveReal; - res->psa = NULL; + res->psa = st != NULL ? &st->airport.psa : NULL; res->u.airport.st = st; res->u.airport.airport_id = airport_id; res->u.airport.layout = layout; diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index 31f024cd0..e2488e779 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -338,6 +338,7 @@ static const SaveLoad _station_desc[] = { SLE_CONDVAR(Station, airport.layout, SLE_UINT8, 145, SL_MAX_VERSION), SLE_VAR(Station, airport.flags, SLE_UINT64), SLE_CONDVAR(Station, airport.rotation, SLE_UINT8, 145, SL_MAX_VERSION), + SLE_CONDARR(Station, airport.psa.storage, SLE_UINT32, 16, 145, SL_MAX_VERSION), SLE_VAR(Station, indtype, SLE_UINT8), diff --git a/src/station_base.h b/src/station_base.h index 997539943..2d345a589 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -17,6 +17,7 @@ #include "newgrf_airport.h" #include "cargopacket.h" #include "industry_type.h" +#include "newgrf_storage.h" typedef Pool<BaseStation, StationID, 32, 64000> StationPool; extern StationPool _station_pool; @@ -47,12 +48,15 @@ struct GoodsEntry { /** All airport-related information. Only valid if tile != INVALID_TILE. */ struct Airport : public TileArea { + typedef PersistentStorageArray<int32, 16> PersistentStorage; + Airport() : TileArea(INVALID_TILE, 0, 0) {} uint64 flags; ///< stores which blocks on the airport are taken. was 16 bit earlier on, then 32 byte type; ///< Type of this airport, @see AirportTypes. byte layout; ///< Airport layout number. Direction rotation; ///< How this airport is rotated. + PersistentStorage psa; ///< Persistent storage for NewGRF airports /** * Get the AirportSpec that from the airport type of this airport. If there |