/** * Get a SaveLoad array for a link graph. * @return SaveLoad array for link graph. */ const SaveLoad *GetLinkGraphDesc() { static const SaveLoad link_graph_desc[] = { SLE_VAR(LinkGraph, last_compression, SLE_INT32), SLEG_VAR(_num_nodes, SLE_UINT16), SLE_VAR(LinkGraph, cargo, SLE_UINT8), SLE_END() }; return link_graph_desc; }
/** The type of the data that follows in the savegame. */ enum SQSaveLoadType { SQSL_INT = 0x00, ///< The following data is an integer. SQSL_STRING = 0x01, ///< The following data is an string. SQSL_ARRAY = 0x02, ///< The following data is an array. SQSL_TABLE = 0x03, ///< The following data is an table. SQSL_BOOL = 0x04, ///< The following data is a boolean. SQSL_NULL = 0x05, ///< A null variable. SQSL_ARRAY_TABLE_END = 0xFF, ///< Marks the end of an array or table, no data follows. }; static byte _script_sl_byte; ///< Used as source/target by the script saveload code to store/load a single byte. /** SaveLoad array that saves/loads exactly one byte. */ static const SaveLoad _script_byte[] = { SLEG_VAR(_script_sl_byte, SLE_UINT8), SLE_END() }; /* static */ bool ScriptInstance::SaveObject(HSQUIRRELVM vm, SQInteger index, int max_depth, bool test) { if (max_depth == 0) { ScriptLog::Error("Savedata can only be nested to 25 deep. No data saved."); // SQUIRREL_MAX_DEPTH = 25 return false; } switch (sq_gettype(vm, index)) { case OT_INTEGER: { if (!test) { _script_sl_byte = SQSL_INT; SlObject(NULL, _script_byte);
/** The type of the data that follows in the savegame. */ enum SQSaveLoadType { SQSL_INT = 0x00, ///< The following data is an integer. SQSL_STRING = 0x01, ///< The following data is an string. SQSL_ARRAY = 0x02, ///< The following data is an array. SQSL_TABLE = 0x03, ///< The following data is an table. SQSL_BOOL = 0x04, ///< The following data is a boolean. SQSL_NULL = 0x05, ///< A null variable. SQSL_ARRAY_TABLE_END = 0xFF, ///< Marks the end of an array or table, no data follows. }; static byte _ai_sl_byte; static const SaveLoad _ai_byte[] = { SLEG_VAR(_ai_sl_byte, SLE_UINT8), SLE_END() }; enum { AISAVE_MAX_DEPTH = 25, ///< The maximum recursive depth for items stored in the savegame. }; /* static */ bool AIInstance::SaveObject(HSQUIRRELVM vm, SQInteger index, int max_depth, bool test) { if (max_depth == 0) { AILog::Error("Savedata can only be nested to 25 deep. No data saved."); return false; } switch (sq_gettype(vm, index)) {
{ Load_NewGRFMapping(_industile_mngr); } static void Ptrs_INDY() { Industry *i; FOR_ALL_INDUSTRIES(i) { SlObject(i, _industry_desc); } } /** Description of the data to save and load in #IndustryBuildData. */ static const SaveLoad _industry_builder_desc[] = { SLEG_VAR(_industry_builder.wanted_inds, SLE_UINT32), SLEG_END() }; /** Load/save industry builder. */ static void LoadSave_IBLD() { SlGlobList(_industry_builder_desc); } /** Description of the data to save and load in #IndustryTypeBuildData. */ static const SaveLoad _industrytype_builder_desc[] = { SLE_VAR(IndustryTypeBuildData, probability, SLE_UINT32), SLE_VAR(IndustryTypeBuildData, min_number, SLE_UINT8), SLE_VAR(IndustryTypeBuildData, target_count, SLE_UINT16), SLE_VAR(IndustryTypeBuildData, max_wait, SLE_UINT16),
w->viewport->dest_scrollpos_y = _saved_scrollpos_y; ViewPort *vp = w->viewport; vp->zoom = (ZoomLevel)min(_saved_scrollpos_zoom, ZOOM_LVL_MAX); vp->virtual_width = ScaleByZoom(vp->width, vp->zoom); vp->virtual_height = ScaleByZoom(vp->height, vp->zoom); DoZoomInOutWindow(ZOOM_NONE, w); // update button status MarkWholeScreenDirty(); } static const SaveLoadGlobVarList _date_desc[] = { SLEG_CONDVAR(_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 30), SLEG_CONDVAR(_date, SLE_INT32, 31, SL_MAX_VERSION), SLEG_VAR(_date_fract, SLE_UINT16), SLEG_VAR(_tick_counter, SLE_UINT16), SLE_CONDNULL(2, 0, 156), // _vehicle_id_ctr_day SLEG_VAR(_age_cargo_skip_counter, SLE_UINT8), SLE_CONDNULL(1, 0, 45), SLEG_CONDVAR(_cur_tileloop_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLEG_CONDVAR(_cur_tileloop_tile, SLE_UINT32, 6, SL_MAX_VERSION), SLEG_VAR(_disaster_delay, SLE_UINT16), SLE_CONDNULL(2, 0, 119), SLEG_VAR(_random.state[0], SLE_UINT32), SLEG_VAR(_random.state[1], SLE_UINT32), SLE_CONDNULL(1, 0, 9), SLE_CONDNULL(4, 10, 119), SLEG_VAR(_cur_company_tick_index, SLE_FILE_U8 | SLE_VAR_U32), SLEG_CONDVAR(_next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32, 0, 108), SLEG_CONDVAR(_next_competitor_start, SLE_UINT32, 109, SL_MAX_VERSION),