const SaveLoad *GetOrderDescription() { static const SaveLoad _order_desc[] = { SLE_VAR(Order, type, SLE_UINT8), SLE_VAR(Order, flags, SLE_UINT8), SLE_VAR(Order, dest, SLE_UINT16), SLE_REF(Order, next, REF_ORDER), SLE_CONDVAR(Order, refit_cargo, SLE_UINT8, 36, SL_MAX_VERSION), SLE_CONDVAR(Order, refit_subtype, SLE_UINT8, 36, SL_MAX_VERSION), SLE_CONDVAR(Order, wait_time, SLE_UINT16, 67, SL_MAX_VERSION), SLE_CONDVAR(Order, travel_time, SLE_UINT16, 67, SL_MAX_VERSION), /* Leftover from the minor savegame version stuff * We will never use those free bytes, but we have to keep this line to allow loading of old savegames */ SLE_CONDNULL(10, 5, 35), SLE_END() }; return _order_desc; }
/** * Wrapper function to get the GoodsEntry's internal structure while * some of the variables itself are private. * @return the saveload description for GoodsEntry. */ const SaveLoad *GetGoodsDesc() { 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), SLE_VAR(GoodsEntry, days_since_pickup, SLE_UINT8), SLE_VAR(GoodsEntry, rating, SLE_UINT8), SLEG_CONDVAR( _cargo_source, SLE_FILE_U8 | SLE_VAR_U16, 0, 6), SLEG_CONDVAR( _cargo_source, SLE_UINT16, 7, 67), SLEG_CONDVAR( _cargo_source_xy, SLE_UINT32, 44, 67), SLEG_CONDVAR( _cargo_days, SLE_UINT8, 0, 67), SLE_VAR(GoodsEntry, last_speed, SLE_UINT8), SLE_VAR(GoodsEntry, last_age, SLE_UINT8), SLEG_CONDVAR( _cargo_feeder_share, SLE_FILE_U32 | SLE_VAR_I64, 14, 64), SLEG_CONDVAR( _cargo_feeder_share, SLE_INT64, 65, 67), SLE_CONDLST(GoodsEntry, cargo.packets, REF_CARGO_PACKET, 68, SL_MAX_VERSION), SLE_END() }; return goods_desc; }
* This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file signs_sl.cpp Code handling saving and loading of economy data */ #include "../stdafx.h" #include "../signs_base.h" #include "saveload.h" /** Description of a sign within the savegame. */ static const SaveLoad _sign_desc[] = { SLE_CONDVAR(Sign, name, SLE_NAME, 0, 83), SLE_CONDSTR(Sign, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION), SLE_CONDVAR(Sign, x, SLE_FILE_I16 | SLE_VAR_I32, 0, 4), SLE_CONDVAR(Sign, y, SLE_FILE_I16 | SLE_VAR_I32, 0, 4), SLE_CONDVAR(Sign, x, SLE_INT32, 5, SL_MAX_VERSION), SLE_CONDVAR(Sign, y, SLE_INT32, 5, SL_MAX_VERSION), SLE_CONDVAR(Sign, owner, SLE_UINT8, 6, SL_MAX_VERSION), SLE_CONDVAR(Sign, z, SLE_FILE_U8 | SLE_VAR_I32, 0, 163), SLE_CONDVAR(Sign, z, SLE_INT32, 164, SL_MAX_VERSION), SLE_END() }; /** Save all signs */ static void Save_SIGN() { Sign *si;
{ static const SaveLoad schedule_desc[] = { SLE_LST(LinkGraphSchedule, schedule, REF_LINK_GRAPH), SLE_LST(LinkGraphSchedule, running, REF_LINK_GRAPH_JOB), SLE_END() }; return schedule_desc; } /* Edges and nodes are saved in the correct order, so we don't need to save their IDs. */ /** * SaveLoad desc for a link graph node. */ static const SaveLoad _node_desc[] = { SLE_CONDVAR(Node, xy, SLE_UINT32, 191, SL_MAX_VERSION), SLE_VAR(Node, supply, SLE_UINT32), SLE_VAR(Node, demand, SLE_UINT32), SLE_VAR(Node, station, SLE_UINT16), SLE_VAR(Node, last_update, SLE_INT32), SLE_END() }; /** * SaveLoad desc for a link graph edge. */ static const SaveLoad _edge_desc[] = { SLE_CONDNULL(4, 0, 190), // distance SLE_VAR(Edge, capacity, SLE_UINT32), SLE_VAR(Edge, usage, SLE_UINT32), SLE_VAR(Edge, last_unrestricted_update, SLE_INT32),
/* * This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file engine_sl.cpp Code handling saving and loading of engines */ #include "../stdafx.h" #include "saveload_internal.h" #include "../engine_base.h" #include <map> static const SaveLoad _engine_desc[] = { SLE_CONDVAR(Engine, intro_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 30), SLE_CONDVAR(Engine, intro_date, SLE_INT32, 31, SL_MAX_VERSION), SLE_CONDVAR(Engine, age, SLE_FILE_U16 | SLE_VAR_I32, 0, 30), SLE_CONDVAR(Engine, age, SLE_INT32, 31, SL_MAX_VERSION), SLE_VAR(Engine, reliability, SLE_UINT16), SLE_VAR(Engine, reliability_spd_dec, SLE_UINT16), SLE_VAR(Engine, reliability_start, SLE_UINT16), SLE_VAR(Engine, reliability_max, SLE_UINT16), SLE_VAR(Engine, reliability_final, SLE_UINT16), SLE_VAR(Engine, duration_phase_1, SLE_UINT16), SLE_VAR(Engine, duration_phase_2, SLE_UINT16), SLE_VAR(Engine, duration_phase_3, SLE_UINT16), SLE_CONDNULL(1, 0, 120), SLE_VAR(Engine, flags, SLE_UINT8), SLE_CONDNULL(1, 0, 178), // old preview_company_rank
/* * This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file storage_sl.cpp Code handling saving and loading of persistent storages. */ #include "../stdafx.h" #include "../newgrf_storage.h" #include "saveload.h" /** Description of the data to save and load in #PersistentStorage. */ static const SaveLoad _storage_desc[] = { SLE_CONDVAR(PersistentStorage, grfid, SLE_UINT32, 6, SL_MAX_VERSION), SLE_CONDARR(PersistentStorage, storage, SLE_UINT32, 16, 161, SL_MAX_VERSION), SLE_END() }; /** Load persistent storage data. */ static void Load_PSAC() { int index; while ((index = SlIterateArray()) != -1) { assert(PersistentStorage::CanAllocateItem()); PersistentStorage *ps = new (index) PersistentStorage(0); SlObject(ps, _storage_desc); } }
*/ /** @file depot_sl.cpp Code handling saving and loading of depots */ #include "../stdafx.h" #include "../depot_base.h" #include "../town.h" #include "saveload.h" #include "../safeguards.h" static TownID _town_index; static const SaveLoad _depot_desc[] = { SLE_CONDVAR(Depot, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(Depot, xy, SLE_UINT32, 6, SL_MAX_VERSION), SLEG_CONDVAR(_town_index, SLE_UINT16, 0, 140), SLE_CONDREF(Depot, town, REF_TOWN, 141, SL_MAX_VERSION), SLE_CONDVAR(Depot, town_cn, SLE_UINT16, 141, SL_MAX_VERSION), SLE_CONDSTR(Depot, name, SLE_STR, 0, 141, SL_MAX_VERSION), SLE_CONDVAR(Depot, build_date, SLE_INT32, 142, SL_MAX_VERSION), SLE_END() }; static void Save_DEPT() { Depot *depot; FOR_ALL_DEPOTS(depot) { SlSetArrayIndex(depot->index);
*/ /** @file goal_sl.cpp Code handling saving and loading of goals */ #include "../stdafx.h" #include "../goal_base.h" #include "saveload.h" static const SaveLoad _goals_desc[] = { SLE_VAR(Goal, company, SLE_UINT16), SLE_VAR(Goal, type, SLE_UINT16), SLE_VAR(Goal, dst, SLE_UINT32), SLE_STR(Goal, text, SLE_STR | SLF_ALLOW_CONTROL, 0), SLE_CONDSTR(Goal, progress, SLE_STR | SLF_ALLOW_CONTROL, 0, 182, SL_MAX_VERSION), SLE_CONDVAR(Goal, completed, SLE_BOOL, 182, SL_MAX_VERSION), SLE_END() }; static void Save_GOAL() { Goal *s; FOR_ALL_GOALS(s) { SlSetArrayIndex(s->index); SlObject(s, _goals_desc); } } static void Load_GOAL() { int index;
if (IsHouseCompleted(t)) town->population += HouseSpec::Get(house_id)->population; /* Increase the number of houses for every house, but only once. */ if (GetHouseNorthPart(house_id) == 0) town->num_houses++; } /* Update the population and num_house dependant values */ FOR_ALL_TOWNS(town) { UpdateTownRadius(town); UpdateTownCargos(town); } } /** Save and load of towns. */ static const SaveLoad _town_desc[] = { SLE_CONDVAR(Town, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(Town, xy, SLE_UINT32, 6, SL_MAX_VERSION), SLE_CONDNULL(2, 0, 2), ///< population, no longer in use SLE_CONDNULL(4, 3, 84), ///< population, no longer in use SLE_CONDNULL(2, 0, 91), ///< num_houses, no longer in use SLE_CONDVAR(Town, townnamegrfid, SLE_UINT32, 66, SL_MAX_VERSION), SLE_VAR(Town, townnametype, SLE_UINT16), SLE_VAR(Town, townnameparts, SLE_UINT32), SLE_CONDSTR(Town, name, SLE_STR, 0, 84, SL_MAX_VERSION), SLE_VAR(Town, flags, SLE_UINT8), SLE_CONDVAR(Town, statues, SLE_FILE_U8 | SLE_VAR_U16, 0, 103), SLE_CONDVAR(Town, statues, SLE_UINT16, 104, SL_MAX_VERSION),
* This file is part of OpenCoaster Tycoon. * OpenCoaster Tycoon is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenCoaster Tycoon is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenCoaster Tycoon. If not, see <http://www.gnu.org/licenses/>. */ /** @file industry_sl.cpp Code handling saving and loading of industries */ #include "../stdafx.h" #include "../industry.h" #include "saveload.h" #include "newgrf_sl.h" static const SaveLoad _industry_desc[] = { SLE_CONDVAR(Industry, location.tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(Industry, location.tile, SLE_UINT32, 6, SL_MAX_VERSION), SLE_VAR(Industry, location.w, SLE_FILE_U8 | SLE_VAR_U16), SLE_VAR(Industry, location.h, SLE_FILE_U8 | SLE_VAR_U16), SLE_REF(Industry, town, REF_TOWN), SLE_CONDNULL( 2, 0, 60), ///< used to be industry's produced_cargo SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, 78, SL_MAX_VERSION), SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 3, 70, SL_MAX_VERSION), SLE_ARR(Industry, produced_cargo_waiting, SLE_UINT16, 2), SLE_ARR(Industry, production_rate, SLE_UINT8, 2), SLE_CONDNULL( 3, 0, 60), ///< used to be industry's accepts_cargo SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 3, 78, SL_MAX_VERSION), SLE_VAR(Industry, prod_level, SLE_UINT8), SLE_ARR(Industry, this_month_production, SLE_UINT16, 2), SLE_ARR(Industry, this_month_transported, SLE_UINT16, 2), SLE_ARR(Industry, last_month_pct_transported, SLE_UINT8, 2),
SlArray(NULL, 49, SLE_FILE_U16 | SLE_VAR_NULL); } /** Cargo payment rates in pre 126 savegames */ static void Load_CAPR() { uint num_cargo = IsSavegameVersionBefore(55) ? 12 : NUM_CARGO; int vt = IsSavegameVersionBefore(65) ? SLE_FILE_I32 : SLE_FILE_I64; SlArray(NULL, num_cargo, vt | SLE_VAR_NULL); SlArray(NULL, num_cargo, SLE_FILE_U16 | SLE_VAR_NULL); } static const SaveLoad _economy_desc[] = { SLE_CONDNULL(4, 0, 64), // max_loan SLE_CONDNULL(8, 65, 143), // max_loan SLE_CONDVAR(Economy, old_max_loan_unround, SLE_FILE_I32 | SLE_VAR_I64, 0, 64), SLE_CONDVAR(Economy, old_max_loan_unround, SLE_INT64, 65, 125), SLE_CONDVAR(Economy, old_max_loan_unround_fract, SLE_UINT16, 70, 125), SLE_CONDVAR(Economy, inflation_prices, SLE_UINT64, 126, SL_MAX_VERSION), SLE_CONDVAR(Economy, inflation_payment, SLE_UINT64, 126, SL_MAX_VERSION), SLE_VAR(Economy, fluct, SLE_INT16), SLE_VAR(Economy, interest_rate, SLE_UINT8), SLE_VAR(Economy, infl_amount, SLE_UINT8), SLE_VAR(Economy, infl_amount_pr, SLE_UINT8), SLE_CONDVAR(Economy, industry_daily_change_counter, SLE_UINT32, 102, SL_MAX_VERSION), SLE_CONDVAR(Economy, industry_helper, SLE_INT64, 181, SL_MAX_VERSION), SLE_END() }; /** Economy variables */ static void Save_ECMY()
for (Order *o = ol->GetFirstOrder(); o != NULL; o = o->next) UpdateWaypointOrder(o); } Vehicle *v; FOR_ALL_VEHICLES(v) { if (v->type != VEH_TRAIN) continue; UpdateWaypointOrder(&v->current_order); } _old_waypoints.Reset(); } static const SaveLoad _old_waypoint_desc[] = { SLE_CONDVAR(OldWaypoint, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(OldWaypoint, xy, SLE_UINT32, 6, SL_MAX_VERSION), SLE_CONDVAR(OldWaypoint, town_index, SLE_UINT16, 12, 121), SLE_CONDREF(OldWaypoint, town, REF_TOWN, 122, SL_MAX_VERSION), SLE_CONDVAR(OldWaypoint, town_cn, SLE_FILE_U8 | SLE_VAR_U16, 12, 88), SLE_CONDVAR(OldWaypoint, town_cn, SLE_UINT16, 89, SL_MAX_VERSION), SLE_CONDVAR(OldWaypoint, string_id, SLE_STRINGID, 0, 83), SLE_CONDSTR(OldWaypoint, name, SLE_STR, 0, 84, SL_MAX_VERSION), SLE_VAR(OldWaypoint, delete_ctr, SLE_UINT8), SLE_CONDVAR(OldWaypoint, build_date, SLE_FILE_U16 | SLE_VAR_I32, 3, 30), SLE_CONDVAR(OldWaypoint, build_date, SLE_INT32, 31, SL_MAX_VERSION), SLE_CONDVAR(OldWaypoint, localidx, SLE_UINT8, 3, SL_MAX_VERSION), SLE_CONDVAR(OldWaypoint, grfid, SLE_UINT32, 17, SL_MAX_VERSION), SLE_CONDVAR(OldWaypoint, owner, SLE_UINT8, 101, SL_MAX_VERSION),
#include "saveload.h" /** Called after load to trash broken pages. */ void AfterLoadStoryBook() { if (IsSavegameVersionBefore(185)) { /* Trash all story pages and page elements because * they were saved with wrong data types. */ _story_page_element_pool.CleanPool(); _story_page_pool.CleanPool(); } } static const SaveLoad _story_page_elements_desc[] = { SLE_CONDVAR(StoryPageElement, sort_value, SLE_FILE_U16 | SLE_VAR_U32, 0, 184), SLE_CONDVAR(StoryPageElement, sort_value, SLE_UINT32, 185, SL_MAX_VERSION), SLE_VAR(StoryPageElement, page, SLE_UINT16), SLE_CONDVAR(StoryPageElement, type, SLE_FILE_U16 | SLE_VAR_U8, 0, 184), SLE_CONDVAR(StoryPageElement, type, SLE_UINT8, 185, SL_MAX_VERSION), SLE_VAR(StoryPageElement, referenced_id, SLE_UINT32), SLE_STR(StoryPageElement, text, SLE_STR | SLF_ALLOW_CONTROL, 0), SLE_END() }; static void Save_STORY_PAGE_ELEMENT() { StoryPageElement *s; FOR_ALL_STORY_PAGE_ELEMENTS(s) { SlSetArrayIndex(s->index); SlObject(s, _story_page_elements_desc);
* The other tiles will get removed later in this loop because * their north tile is not the correct type anymore. */ if (!valid_house) DoClearSquare(t); } else if (!IsTileType(north_tile, MP_HOUSE) || GetCleanHouseType(north_tile) != house_type) { /* This tile should be part of a multi-tile building but the * north tile of this house isn't on the map. */ DoClearSquare(t); } } RebuildTownCaches(); } /** Save and load of towns. */ static const SaveLoad _town_desc[] = { SLE_CONDVAR(Town, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(Town, xy, SLE_UINT32, 6, SL_MAX_VERSION), SLE_CONDNULL(2, 0, 2), ///< population, no longer in use SLE_CONDNULL(4, 3, 84), ///< population, no longer in use SLE_CONDNULL(2, 0, 91), ///< num_houses, no longer in use SLE_CONDVAR(Town, townnamegrfid, SLE_UINT32, 66, SL_MAX_VERSION), SLE_VAR(Town, townnametype, SLE_UINT16), SLE_VAR(Town, townnameparts, SLE_UINT32), SLE_CONDSTR(Town, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION), SLE_VAR(Town, flags, SLE_UINT8), SLE_CONDVAR(Town, statues, SLE_FILE_U8 | SLE_VAR_U16, 0, 103), SLE_CONDVAR(Town, statues, SLE_UINT16, 104, SL_MAX_VERSION),
#include "../stdafx.h" #include "../object_base.h" #include "../object_map.h" #include "saveload.h" #include "newgrf_sl.h" #include "../safeguards.h" static const SaveLoad _object_desc[] = { SLE_VAR(Object, location.tile, SLE_UINT32), SLE_VAR(Object, location.w, SLE_FILE_U8 | SLE_VAR_U16), SLE_VAR(Object, location.h, SLE_FILE_U8 | SLE_VAR_U16), SLE_REF(Object, town, REF_TOWN), SLE_VAR(Object, build_date, SLE_UINT32), SLE_CONDVAR(Object, colour, SLE_UINT8, SLV_148, SL_MAX_VERSION), SLE_CONDVAR(Object, view, SLE_UINT8, SLV_155, SL_MAX_VERSION), SLE_CONDVAR(Object, type, SLE_UINT16, SLV_186, SL_MAX_VERSION), SLE_END() }; static void Save_OBJS() { Object *o; /* Write the objects */ FOR_ALL_OBJECTS(o) { SlSetArrayIndex(o->index); SlObject(o, _object_desc); }
/* * This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file group_sl.cpp Code handling saving and loading of economy data */ #include "../stdafx.h" #include "../group.h" #include "saveload.h" static const SaveLoad _group_desc[] = { SLE_CONDVAR(Group, name, SLE_NAME, 0, 83), SLE_CONDSTR(Group, name, SLE_STR, 0, 84, SL_MAX_VERSION), SLE_VAR(Group, num_vehicle, SLE_UINT16), SLE_VAR(Group, owner, SLE_UINT8), SLE_VAR(Group, vehicle_type, SLE_UINT8), SLE_VAR(Group, replace_protection, SLE_BOOL), SLE_END() }; static void Save_GRPS() { Group *g; FOR_ALL_GROUPS(g) { SlSetArrayIndex(g->index); SlObject(g, _group_desc);
/* Index was saved in some versions, but this is not needed */ SLE_CONDNULL(4, 0, 8), SLE_CONDNULL(2, 0, 44), SLE_CONDNULL(1, 0, 25), SLE_REF(RoadStop, next, REF_ROADSTOPS), SLE_CONDNULL(2, 0, 44), SLE_CONDNULL(4, 0, 24), SLE_CONDNULL(1, 25, 25), SLE_END() }; static const SaveLoad _old_station_desc[] = { SLE_CONDVAR(Station, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(Station, xy, SLE_UINT32, 6, SL_MAX_VERSION), SLE_CONDNULL(4, 0, 5), ///< bus/lorry tile SLE_CONDVAR(Station, train_station.tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(Station, train_station.tile, SLE_UINT32, 6, SL_MAX_VERSION), SLE_CONDVAR(Station, airport_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(Station, airport_tile, SLE_UINT32, 6, SL_MAX_VERSION), SLE_CONDVAR(Station, dock_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLE_CONDVAR(Station, dock_tile, SLE_UINT32, 6, SL_MAX_VERSION), SLE_REF(Station, town, REF_TOWN), SLE_VAR(Station, train_station.w, SLE_UINT8), SLE_CONDVAR(Station, train_station.h, SLE_UINT8, 2, SL_MAX_VERSION), SLE_CONDNULL(1, 0, 3), ///< alpha_order SLE_VAR(Station, string_id, SLE_STRINGID),
uint max_id = mapping.GetMaxMapping(); int index; while ((index = SlIterateArray()) != -1) { if ((uint)index >= max_id) break; SlObject(&mapping.mapping_ID[index], _newgrf_mapping_desc); } } static const SaveLoad _grfconfig_desc[] = { SLE_STR(GRFConfig, filename, SLE_STR, 0x40), SLE_VAR(GRFConfig, ident.grfid, SLE_UINT32), SLE_ARR(GRFConfig, ident.md5sum, SLE_UINT8, 16), SLE_CONDVAR(GRFConfig, version, SLE_UINT32, 151, SL_MAX_VERSION), SLE_ARR(GRFConfig, param, SLE_UINT32, 0x80), SLE_VAR(GRFConfig, num_params, SLE_UINT8), SLE_CONDVAR(GRFConfig, palette, SLE_UINT8, 101, SL_MAX_VERSION), SLE_END() }; static void Save_NGRF() { int index = 0; for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) { if (HasBit(c->flags, GCF_STATIC)) continue; SlSetArrayIndex(index++); SlObject(c, _grfconfig_desc);
/** @file autoreplace_sl.cpp Code handling saving and loading of autoreplace rules */ #include "../stdafx.h" #include "../autoreplace_base.h" #include "saveload.h" #include "../safeguards.h" static const SaveLoad _engine_renew_desc[] = { SLE_VAR(EngineRenew, from, SLE_UINT16), SLE_VAR(EngineRenew, to, SLE_UINT16), SLE_REF(EngineRenew, next, REF_ENGINE_RENEWS), SLE_CONDVAR(EngineRenew, group_id, SLE_UINT16, SLV_60, SL_MAX_VERSION), SLE_CONDVAR(EngineRenew, replace_when_old, SLE_BOOL, SLV_175, SL_MAX_VERSION), SLE_END() }; static void Save_ERNW() { EngineRenew *er; FOR_ALL_ENGINE_RENEWS(er) { SlSetArrayIndex(er->index); SlObject(er, _engine_renew_desc); } } static void Load_ERNW()