summaryrefslogtreecommitdiff
path: root/src/saveload/saveload.cpp
AgeCommit message (Collapse)Author
2021-06-14Codechange: remove the special station/vehicle code from SaveLoadPatric Stout
With the new SLEG_STRUCT it is much easier to embed a struct in a struct, where the sub-struct has limitations on when it is being used. This makes both the code easier to read (less magic) and avoids the SaveLoad needing to know all these things about Stations and Vehicles.
2021-06-14Codechange: ability to store structs and list of structs in savegamesPatric Stout
The commits following this will use this new functionality. Currently, a few places do this manually. This has as drawback that the Save() and Load() code need to be in sync, and that any change can result in (old) savegames no longer loading. In general, it is annoying code to maintain. By putting everything in a description table, and use that for both Save() and Load(), it becomes easier to see what is going on, and hopefully less likely for people to make mistakes.
2021-06-13Codechange: convert printf DEBUG statements to fmt Debug statementsrubidium42
2021-06-10Codechange: rename SL_LST to SL_REFLIST to highlight the "reference" partPatric Stout
You can easily mistake SlList / SL_LST to be a list of SL_VAR, but it is a list of SL_REF. With this rename, it hopefully saves a few people from "wtf?" moments.
2021-06-10Codechange: refactor SlList to use SlStorageHelperPatric Stout
2021-06-10Codechange: refactor SlDequeueHelper to work with unsigned and be more genericPatric Stout
Future additions will start using it for std::list too.
2021-06-10Codechange: use wrappers to get Var[Mem|File]Type, instead of GB()Patric Stout
2021-06-10Codechange: move GetVariableAddress inside SlObjectMemberPatric Stout
Also move it to static, as nobody else is using it.
2021-06-07Codechange: make [Save|Load]Settings() behave more like other Save/Load code ↵Patric Stout
(#9335) Prepare the full description and send it to SlObject. This does require some code to be able to read to a SLE_VAR_NULL, like strings etc, as there is no way to know their length beforehand.
2021-06-06Codechange: move SLF_NO_NETWORK_SYNC into settingsPatric Stout
It is a settings-only flag, so don't pollute SaveLoad code with it.
2021-06-06Codechange: move SLF_NOT_IN_SAVE into settingsPatric Stout
It is a settings-only flag, so don't pollute SaveLoad code with it.
2021-06-06Codechange: Remove FOR_ALL_CHUNK_HANDLERSglx22
Co-Authored-By: Patric Stout <truebrain@openttd.org>
2021-06-03Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways ↵Patric Stout
we had While at it, replace OTTD_ASSERT with WITH_ASSERT, as this is always set if assert() is valid. No matter if NDEBUG is set or not.
2021-05-31Codechange: C++-ify lists for SaveLoad (#9323)Patric Stout
Basically, this changes "SaveLoad *" to either: 1) "SaveLoadTable" if a list of SaveLoads was meant 2) "SaveLoad &" if a single entry was meant As added bonus, this removes SL_END / SLE_END / SLEG_END. This also adds core/span.hpp, a "std::span"-lite.
2021-05-29Codechange: rename str_validate to StrMakeValid(InPlace) (#9304)Patric Stout
This to be more explicit the function changes the value, and not returns yes/no.
2021-05-15Change: Use gender-neutral pronounsrubidium42
2021-05-13Codechange: clean up C-string support from settingsrubidium42
2021-05-13Codechange: move misc settings to std::stringrubidium42
2021-04-29Fix: [MinGW] Set minimum OS version to Windows XP (#9135)Loïc Guilloux
2021-02-28Add: settings to limit your fast-forward game speedPatric Stout
By default this setting is set to 2500% normal game speed.
2021-01-08Codechange: Remove min/max functions in favour of STL variants (#8502)Charles Pigott
2021-01-01Codechange: move some DEBUG-levels and remove some others in saveload ↵Patric Stout
routine (#8474) When running with -dsl=2 it is very easy to miss important information as there was a lot of noise in between too. This tunes the debug levels a bit to be less noisy while keeping the important bits.
2020-12-27Codechange: Even more std::string usage in file IO.Michael Lutz
2020-12-27Codechange: Convert some more FIO functions to take std::string.Michael Lutz
2020-12-27Codechange: Replace assert_compile macro with static_assertCharles Pigott
2020-12-27Cleanup: Remove unused ChunkType flag CH_AUTO_LENGTHcirdan
CH_AUTO_LENGTH is no longer used anywhere, so remove all code that depends on it.
2020-12-22Fix: next 67 savegame versions are used in PatchPacks; skip them (#8411)Patric Stout
Various of PatchPacks (Spring 2013, Joker, ChillPP) used versions slightly higher than ours. Of course, as time went by, this caught up with us, and we are now almost pushing a new version that would conflict with them. To avoid users creating unneeded issues about "why can I not load my savegame", lets be ahead of the curve and flat-out refuse to load them. Version-wise, this is totally fine. We have ~32k versions to go before we run out (0x8000 is masked by JGRPP; we should avoid using that). At the rate we bump savegames, this is not going to happen in any sane reality.
2020-12-15Add: support for emscripten (play-OpenTTD-in-the-browser)Patric Stout
Emscripten compiles to WASM, which can be loaded via HTML / JavaScript. This allows you to play OpenTTD inside a browser. Co-authored-by: milek7 <me@milek7.pl>
2020-12-06Codechange: don't do work GetVariableAddress() is already doingPatric Stout
2020-06-28Codechange: Move SlSkipBytes to saveload.hJonathan G Rennison
2020-05-21Codechange: Use std::string for most of the user-settable custom names.Michael Lutz
2020-05-21Codechange: Store GS lang texts in std::strings.Michael Lutz
2020-05-10Fix: Stop any gamelog action when recovering from SlError()glx
2020-01-12Fix #7925: Reset temporary saveload data at the start of loading a savegame ↵frosch
instead of at the end. Otherwise temporary data may be passed from an aborted load action to the next load action.
2019-12-21Codechange: Replace FOR_ALL_COMPANIES with range-based for loopsglx
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-09-29Fix: Some typos found using codespellJMcKiern
2019-04-29Cleanup: Delete GetSavegameType function since it's been commented out since ↵Charles Pigott
2005
2019-04-13Cleanup: Fix alignment after NULL -> nullptr change.peter1138
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-04-09Remove: AutoFreeSmallVector.Michael Lutz
The last use was for storing a list of memory blocks. As the way these lists are accessed is very specific, it is easier to just write an explicit destructor instead of trying to exactly match the behaviour.
2019-04-06Codechange: Use atomic variables for thread synchronization where useful.Michael Lutz
2019-04-06Codechange: Replace custom thread code with C++11 thread objects.Michael Lutz
We assume a conforming C++11 compiler environment that has a valid <thread>-header. Failure to run a real thread is handled gracefully.
2019-03-26Cleanup: Remove unused size template parameters from SmallMap and ↵Henry Wilson
Auto[Free|Delete]SmallVector
2019-03-26Codechange: Replaced SmallVector::Append() with ↵Henry Wilson
std::vector::[push|emplace]_back()
2019-03-26Codechange: Replace SmallVector::Length() with std::vector::size()Henry Wilson
2019-03-24Codechange: Use override specifer for overriding member declarationsHenry Wilson
This is a C++11 feature that allows the compiler to check that a virtual member declaration overrides a base-class member with the same signature. Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked as virtual despite being a template.
2019-03-11Codechange: liblzma is called liblzma, how ever strange that might bePatric Stout
It is the only library we use that calls itself with 'lib' in the name. This might be confusing, but with the arrival of cmake a lot of these things are automated. And detection will find 'liblzma', not 'lzma', like with 'lzo', 'zlib', ..
2019-02-13Change: Use SlErrorCorrupt() on pool index error when loading a savegame, ↵PeterN
instead of terminating. (#7219)
2019-02-02Codechange: Additional type safety for saveload version variables.Peter Nelson