| 1828 | } |
| 1829 | |
| 1830 | bool LoadTTOMain(LoadgameState &ls) |
| 1831 | { |
| 1832 | Debug(oldloader, 3, "Reading main chunk..."); |
| 1833 | |
| 1834 | _read_ttdpatch_flags = false; |
| 1835 | |
| 1836 | std::array<uint8_t, 103 * sizeof(Engine)> engines; // we don't want to call Engine constructor here |
| 1837 | _old_engines = (Engine *)engines.data(); |
| 1838 | |
| 1839 | /* Load the biggest chunk */ |
| 1840 | if (!LoadChunk(ls, nullptr, main_chunk)) { |
| 1841 | Debug(oldloader, 0, "Loading failed"); |
| 1842 | return false; |
| 1843 | } |
| 1844 | Debug(oldloader, 3, "Done, converting game data..."); |
| 1845 | |
| 1846 | if (_settings_game.game_creation.town_name != 0) _settings_game.game_creation.town_name++; |
| 1847 | |
| 1848 | _settings_game.game_creation.landscape = LandscapeType::Temperate; |
| 1849 | _trees_tick_ctr = 0xFF; |
| 1850 | |
| 1851 | if (!FixTTOMapArray() || !FixTTOEngines()) { |
| 1852 | Debug(oldloader, 0, "Conversion failed"); |
| 1853 | return false; |
| 1854 | } |
| 1855 | |
| 1856 | FixOldTowns(); |
| 1857 | FixOldVehicles(ls); |
| 1858 | FixTTOCompanies(); |
| 1859 | |
| 1860 | /* We have a new difficulty setting */ |
| 1861 | _settings_game.difficulty.town_council_tolerance = Clamp(_old_diff_level, 0, 2); |
| 1862 | |
| 1863 | /* SVXConverter about cargo payment rates correction: |
| 1864 | * "increase them to compensate for the faster time advance in TTD compared to TTO |
| 1865 | * which otherwise would cause much less income while the annual running costs of |
| 1866 | * the vehicles stay the same" */ |
| 1867 | _economy.inflation_payment = std::min(_economy.inflation_payment * 124 / 74, MAX_INFLATION); |
| 1868 | |
| 1869 | Debug(oldloader, 3, "Finished converting game data"); |
| 1870 | Debug(oldloader, 1, "TTO savegame successfully converted"); |
| 1871 | |
| 1872 | return true; |
| 1873 | } |
nothing calls this directly
no test coverage detected