|
OpenTTD Source 15.0-beta1
|
Chunks and fix-ups for TTO/TTD/TTDP savegames. More...
#include "../stdafx.h"#include "../town.h"#include "../industry.h"#include "../company_func.h"#include "../aircraft.h"#include "../roadveh.h"#include "../ship.h"#include "../train.h"#include "../signs_base.h"#include "../station_base.h"#include "../subsidy_base.h"#include "../debug.h"#include "../depot_base.h"#include "../timer/timer_game_calendar.h"#include "../vehicle_func.h"#include "../effectvehicle_base.h"#include "../engine_func.h"#include "../company_base.h"#include "../disaster_vehicle.h"#include "../timer/timer.h"#include "../timer/timer_game_tick.h"#include "saveload_internal.h"#include "oldloader.h"#include "table/strings.h"#include "../table/engines.h"#include "../table/townname.h"#include "../safeguards.h"Go to the source code of this file.
Macros | |
| #define | FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z) |
Functions | |
| void | FixOldMapArray () |
| static void | FixTTDMapArray () |
| static void | FixTTDDepots () |
| static uint32_t | RemapOldTownName (uint32_t townnameparts, uint8_t old_town_name_type) |
| static void | FixOldTowns () |
| void | FixOldVehicles () |
| Convert the old style vehicles into something that resembles the old new style savegames. | |
| static bool | FixTTOMapArray () |
| static bool | FixTTOEngines () |
| static void | FixTTOCompanies () |
| static Colours | RemapTTOColour (Colours tto) |
| static uint | RemapTownIndex (uint x) |
| static uint | RemapOrderIndex (uint x) |
| static void | ClearOldMap3 (TileIndex t) |
| static Town * | RemapTown (TileIndex fallback) |
| static void | ReadTTDPatchFlags () |
| static bool | LoadOldTown (LoadgameState *ls, int num) |
| static bool | LoadOldOrder (LoadgameState *ls, int num) |
| static bool | LoadOldAnimTileList (LoadgameState *ls, int) |
| static bool | LoadOldDepot (LoadgameState *ls, int num) |
| static bool | LoadOldGood (LoadgameState *ls, int num) |
| static bool | LoadOldStation (LoadgameState *ls, int num) |
| static bool | LoadOldIndustry (LoadgameState *ls, int num) |
| static bool | LoadOldCompanyYearly (LoadgameState *ls, int num) |
| static bool | LoadOldCompanyEconomy (LoadgameState *ls, int) |
| static bool | LoadOldCompany (LoadgameState *ls, int num) |
| static bool | LoadOldVehicleUnion (LoadgameState *ls, int) |
| bool | LoadOldVehicle (LoadgameState *ls, int num) |
| Load the vehicles of an old style savegame. | |
| static bool | LoadOldSign (LoadgameState *ls, int num) |
| static bool | LoadOldEngine (LoadgameState *ls, int num) |
| static bool | LoadOldEngineName (LoadgameState *ls, int num) |
| static bool | LoadOldSubsidy (LoadgameState *ls, int num) |
| static bool | LoadOldGameDifficulty (LoadgameState *ls, int) |
| static bool | LoadOldMapPart1 (LoadgameState *ls, int) |
| static bool | LoadOldMapPart2 (LoadgameState *ls, int) |
| static bool | LoadTTDPatchExtraChunks (LoadgameState *ls, int) |
| bool | LoadTTDMain (LoadgameState *ls) |
| bool | LoadTTOMain (LoadgameState *ls) |
Variables | |
| static bool | _read_ttdpatch_flags |
| Have we (tried to) read TTDPatch extra flags? | |
| static uint16_t | _old_extra_chunk_nums |
| Number of extra TTDPatch chunks. | |
| static uint8_t | _old_vehicle_multiplier |
| TTDPatch vehicle multiplier. | |
| static StringID * | _old_vehicle_names |
| static Engine * | _old_engines |
| std::vector< TileIndex > | _animated_tiles |
| The table/list with animated tiles. | |
| TimeoutTimer< TimerGameTick > | _new_competitor_timeout |
| char * | _old_name_array |
| Location to load the old names to. | |
| static uint32_t | _old_town_index |
| static uint16_t | _old_string_id |
| static uint16_t | _old_string_id_2 |
| static const OldChunks | town_chunk [] |
| static uint16_t | _old_order |
| static const OldChunks | order_chunk [] |
| static const OldChunks | depot_chunk [] |
| static StationID | _current_station_id |
| static uint16_t | _waiting_acceptance |
| static uint8_t | _cargo_source |
| static uint8_t | _cargo_periods |
| static const OldChunks | goods_chunk [] |
| static const OldChunks | station_chunk [] |
| static std::array< Industry::AcceptedCargo, INDUSTRY_ORIGINAL_NUM_INPUTS > | _old_accepted {} |
| static std::array< Industry::ProducedCargo, INDUSTRY_ORIGINAL_NUM_OUTPUTS > | _old_produced {} |
| static const OldChunks | industry_chunk [] |
| static CompanyID | _current_company_id |
| static int32_t | _old_yearly |
| static const OldChunks | _company_yearly_chunk [] |
| static const OldChunks | _company_economy_chunk [] |
| static const OldChunks | _company_chunk [] |
| static uint32_t | _old_order_ptr |
| static uint16_t | _old_next_ptr |
| static VehicleID | _current_vehicle_id |
| static const OldChunks | vehicle_train_chunk [] |
| static const OldChunks | vehicle_road_chunk [] |
| static const OldChunks | vehicle_ship_chunk [] |
| static const OldChunks | vehicle_air_chunk [] |
| static const OldChunks | vehicle_effect_chunk [] |
| static const OldChunks | vehicle_disaster_chunk [] |
| static const OldChunks | vehicle_empty_chunk [] |
| static uint16_t | _cargo_count |
| static const OldChunks | vehicle_chunk [] |
| static const OldChunks | sign_chunk [] |
| static const OldChunks | engine_chunk [] |
| static const OldChunks | subsidy_chunk [] |
| static const OldChunks | game_difficulty_chunk [] |
| TileIndex | _cur_tileloop_tile |
| uint16_t | _disaster_delay |
| Delay counter for considering the next disaster. | |
| uint8_t | _trees_tick_ctr |
| Determines when to consider building more trees. | |
| uint8_t | _age_cargo_skip_counter |
| Skip aging of cargo? Used before savegame version 162. | |
| uint8_t | _old_diff_level |
| uint8_t | _old_units |
| static const OldChunks | main_chunk [] |
Chunks and fix-ups for TTO/TTD/TTDP savegames.
TTO loader code is based on SVXConverter by Roman Vetter.
Definition in file oldloader_sl.cpp.
| #define FIXNUM | ( | x, | |
| y, | |||
| z | |||
| ) | (((((x) << 16) / (y)) + 1) << z) |
Definition at line 112 of file oldloader_sl.cpp.
|
static |
Definition at line 491 of file oldloader_sl.cpp.
| void FixOldMapArray | ( | ) |
Definition at line 46 of file oldloader_sl.cpp.
|
static |
Definition at line 145 of file oldloader_sl.cpp.
| void FixOldVehicles | ( | ) |
Convert the old style vehicles into something that resembles the old new style savegames.
Then AfterLoadGame can handle the rest of the conversion.
Definition at line 163 of file oldloader_sl.cpp.
|
static |
Workaround for SVXConverter bug, depots 252-255 could be invalid
Definition at line 102 of file oldloader_sl.cpp.
References GetDepotIndex(), IsDepotTile(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_depot_pool >::Iterate().
|
static |
Definition at line 53 of file oldloader_sl.cpp.
|
static |
Definition at line 451 of file oldloader_sl.cpp.
|
static |
TTD->TTO remapping of engines; 255 means there is no equivalent. SVXConverter uses (almost) the same table.
TTO->TTD remapping of engines. SVXConverter uses the same table.
Definition at line 343 of file oldloader_sl.cpp.
References Engine::age, CalcEngineReliability(), EngineInfo::climates, Engine::company_avail, TimerGameCalendar::ConvertDateToYMD(), TimerGameCalendar::ConvertYMDToDate(), TimerGameCalendar::date, TimerGameConst< struct Calendar >::DAYS_TILL_ORIGINAL_BASE_YEAR, Engine::duration_phase_1, Engine::duration_phase_2, Engine::duration_phase_3, ENGINE_AVAILABLE, Engine::flags, HasBit(), Engine::intro_date, INVALID_COMPANY, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), lengthof, MAX_UVALUE, Engine::name, Engine::preview_asked, Engine::preview_company, Engine::preview_wait, Engine::reliability, Engine::reliability_final, Engine::reliability_max, Engine::reliability_spd_dec, Engine::reliability_start, StartupOneEngine(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
|
static |
Definition at line 213 of file oldloader_sl.cpp.
|
static |
Definition at line 660 of file oldloader_sl.cpp.
|
static |
Definition at line 981 of file oldloader_sl.cpp.
|
static |
Definition at line 920 of file oldloader_sl.cpp.
|
static |
Definition at line 893 of file oldloader_sl.cpp.
|
static |
Definition at line 685 of file oldloader_sl.cpp.
|
static |
Definition at line 1439 of file oldloader_sl.cpp.
|
static |
Definition at line 1445 of file oldloader_sl.cpp.
|
static |
Definition at line 1490 of file oldloader_sl.cpp.
|
static |
Definition at line 716 of file oldloader_sl.cpp.
|
static |
Definition at line 855 of file oldloader_sl.cpp.
|
static |
Definition at line 1498 of file oldloader_sl.cpp.
|
static |
Definition at line 1527 of file oldloader_sl.cpp.
|
static |
Definition at line 641 of file oldloader_sl.cpp.
|
static |
Definition at line 1397 of file oldloader_sl.cpp.
|
static |
Definition at line 773 of file oldloader_sl.cpp.
|
static |
Definition at line 1461 of file oldloader_sl.cpp.
|
static |
Definition at line 618 of file oldloader_sl.cpp.
| bool LoadOldVehicle | ( | LoadgameState * | ls, |
| int | num | ||
| ) |
Load the vehicles of an old style savegame.
So we can set the proper next pointer while loading.
| ls | State (buffer) of the currently loaded game. |
| num | The number of vehicles to load. |
Definition at line 1249 of file oldloader_sl.cpp.
|
static |
Definition at line 1123 of file oldloader_sl.cpp.
| bool LoadTTDMain | ( | LoadgameState * | ls | ) |
Definition at line 1771 of file oldloader_sl.cpp.
|
static |
Definition at line 1539 of file oldloader_sl.cpp.
| bool LoadTTOMain | ( | LoadgameState * | ls | ) |
Definition at line 1813 of file oldloader_sl.cpp.
|
static |
Definition at line 511 of file oldloader_sl.cpp.
|
static |
Definition at line 114 of file oldloader_sl.cpp.
|
inlinestatic |
Definition at line 478 of file oldloader_sl.cpp.
Definition at line 498 of file oldloader_sl.cpp.
|
inlinestatic |
Definition at line 473 of file oldloader_sl.cpp.
|
inlinestatic |
Lossy remapping of TTO colours to TTD colours. SVXConverter uses the same conversion.
Definition at line 458 of file oldloader_sl.cpp.
|
extern |
Skip aging of cargo? Used before savegame version 162.
Definition at line 79 of file misc_sl.cpp.
|
extern |
The table/list with animated tiles.
Definition at line 20 of file animated_tile.cpp.
Referenced by AddAnimatedTile(), AfterLoadGame(), AnimateAnimatedTiles(), DeleteAnimatedTile(), and InitializeAnimatedTiles().
|
static |
Definition at line 1152 of file oldloader_sl.cpp.
|
static |
Definition at line 702 of file oldloader_sl.cpp.
|
static |
Definition at line 701 of file oldloader_sl.cpp.
|
static |
Definition at line 940 of file oldloader_sl.cpp.
|
static |
Definition at line 910 of file oldloader_sl.cpp.
|
static |
Definition at line 888 of file oldloader_sl.cpp.
|
extern |
Definition at line 764 of file landscape.cpp.
|
static |
Definition at line 885 of file oldloader_sl.cpp.
|
static |
Definition at line 699 of file oldloader_sl.cpp.
|
static |
Definition at line 1053 of file oldloader_sl.cpp.
|
extern |
Delay counter for considering the next disaster.
Definition at line 57 of file disaster_vehicle.cpp.
|
static |
Definition at line 808 of file oldloader_sl.cpp.
|
static |
Definition at line 341 of file oldloader_sl.cpp.
|
static |
Number of extra TTDPatch chunks.
Definition at line 43 of file oldloader_sl.cpp.
|
extern |
Location to load the old names to.
Definition at line 52 of file strings_sl.cpp.
Referenced by CopyFromOldName(), InitializeOldNames(), NAMEChunkHandler::Load(), and ResetOldNames().
|
static |
Definition at line 1052 of file oldloader_sl.cpp.
|
static |
Definition at line 635 of file oldloader_sl.cpp.
|
static |
Definition at line 1051 of file oldloader_sl.cpp.
|
static |
Definition at line 809 of file oldloader_sl.cpp.
|
static |
Definition at line 488 of file oldloader_sl.cpp.
|
static |
Definition at line 489 of file oldloader_sl.cpp.
|
static |
Definition at line 487 of file oldloader_sl.cpp.
|
static |
TTDPatch vehicle multiplier.
Definition at line 44 of file oldloader_sl.cpp.
|
static |
Definition at line 156 of file oldloader_sl.cpp.
|
static |
Definition at line 886 of file oldloader_sl.cpp.
|
static |
Have we (tried to) read TTDPatch extra flags?
Definition at line 42 of file oldloader_sl.cpp.
|
extern |
Determines when to consider building more trees.
Definition at line 55 of file tree_cmd.cpp.
Referenced by DecrementTreeCounter().
|
static |
Definition at line 700 of file oldloader_sl.cpp.
|
static |
Definition at line 679 of file oldloader_sl.cpp.
|
static |
Definition at line 1416 of file oldloader_sl.cpp.
|
static |
Definition at line 1469 of file oldloader_sl.cpp.
|
static |
Definition at line 704 of file oldloader_sl.cpp.
|
static |
Definition at line 811 of file oldloader_sl.cpp.
|
static |
Definition at line 1601 of file oldloader_sl.cpp.
|
static |
Definition at line 636 of file oldloader_sl.cpp.
|
static |
Definition at line 1386 of file oldloader_sl.cpp.
|
static |
Definition at line 736 of file oldloader_sl.cpp.
|
static |
|
static |
Definition at line 566 of file oldloader_sl.cpp.
|
static |
Definition at line 1088 of file oldloader_sl.cpp.
|
static |
Definition at line 1154 of file oldloader_sl.cpp.
|
static |
Definition at line 1108 of file oldloader_sl.cpp.
|
static |
Definition at line 1099 of file oldloader_sl.cpp.
|
static |
Definition at line 1117 of file oldloader_sl.cpp.
|
static |
Definition at line 1066 of file oldloader_sl.cpp.
|
static |
Definition at line 1080 of file oldloader_sl.cpp.