summaryrefslogtreecommitdiff
path: root/src/saveload/linkgraph_sl.cpp
AgeCommit message (Collapse)Author
2021-07-09Codechange: split settings.ini over several files (#9421)Patric Stout
This reduced the load on compilers, as currently for example MacOS doesn't like the huge settings-tables. Additionally, nobody can find settings, as the list is massive and unordered. By splitting it, it becomes a little bit more sensible.
2021-07-06Cleanup: Remove now unneeded ChunkHandler membersglx22
2021-07-06Codechange: Use ChunkHandlers sub-classesglx22
2021-07-06Codechange: Use static array of references to ChunkHandlerglx22
2021-07-02Add: store headers for chunks with SL_STRUCTLISTPatric Stout
2021-07-02Feature: framework to make savegames self-descriptivePatric Stout
We won't be able to make it fully self-descriptive (looking at you MAP-chunks), but anything else can. With this framework, we can add headers for each chunk explaining how each chunk looks like in detail. They also will all be tables, making it a lot easier to read in external tooling, and opening the way to consider a database (like SQLite) to use as savegame format. Lastly, with the headers in the savegame, you can freely add fields without needing a savegame version bump; older versions of OpenTTD will simply ignore the new field. This also means we can remove all the SLE_CONDNULL, as they are irrelevant. The next few commits will start using this framework.
2021-06-15Change: rework several CH_RIFF chunks to use CH_ARRAY insteadPatric Stout
This adds two byte extra to those chunks, and might feel a bit silly at first. But in later changes we will prefix CH_ARRAY with a table header, and then this change shines. Without this, we could still add headers to these chunks, but any external reader wouldn't know if the CH_RIFF has them or not. This way is much more practical, as they are now more like any other chunk.
2021-06-15Change: store length of SL_STRUCTLIST in the savegamePatric Stout
This wasn't consistently done, and often variables were used that were read by an earlier blob. By moving it next to the struct itself, the code becomes a bit more self-contained and easier to read. Additionally, this allows for external tooling to know how many structs to expect, instead of having to know where to find the length-field or a hard-coded value that can change at any moment.
2021-06-14Codechange: use SLE_STRUCT(LIST) for Linkgraph chunksPatric Stout
2021-06-14Codechange: move Save/Load functions of same chunk next to each otherPatric Stout
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-06Codechange: Remove FOR_ALL_CHUNK_HANDLERSglx22
Co-Authored-By: Patric Stout <truebrain@openttd.org>
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-30Codechange: add a wrapper function to find all settings based on prefix (#9312)Patric Stout
2021-05-27Codechange: use initializer_lists for the settings tablesrubidium42
Not using vectors as those require copying from the initializer list and that makes unique_ptrs to the actual SettingDesc objects later impossible.
2021-05-27Codechange: let SettingDesc extend SettingDescBaserubidium42
2021-05-15Fix: comparison of narrow type to wide type in loop (potential for infinite ↵Rubidium
loops)
2021-04-17Fix: Corrupted savegame could cause heap corruption by writing outside link ↵Milek7
graph edge matrix. (#9046)
2021-02-13Codechange: Don't use cpp_offsetof in the save/load code.Michael Lutz
Many of the member variables that are used in save/load are inside types that are not standard layout types. Using pointer arithmetics to determine addresses of members inside types that are not standard layout is generally undefined behaviour. If we'd use C++17, it is conditionally supported, which means each compiler may or may not support it. And even then using it for individual array elements is syntactically not supported the the standard offsetof function. Unfortunately, the trickery employed for saving linkgraph settings causes quite some clutter in the settings ini files.
2020-12-22Change: [Linkgraph] Pause the game when linkgraph jobs lag (#6470)Jonathan G Rennison
Check if the job is still running two date fract ticks before it is due to join, and if so pause the game until its done. When loading a game, check if the game would block immediately due to a job which is scheduled to be joined within two date fract ticks, and if so pause the game until its done. This avoids the main thread being blocked on a thread join, which appears to the user as if the game is unresponsive, as the UI does not repaint and cannot be interacted with. Show if pause is due to link graph job in status bar, update network messages. This does not apply for network clients.
2019-12-21Codechange: Replace linkgraph related FOR_ALL with range-based for loopsglx
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-05-10Fix #7577: Check if linkgraph station index is valid before dereferencing. ↵PeterN
(#7583)
2019-04-13Cleanup: Fix alignment after NULL -> nullptr change.peter1138
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-03-26Codechange: Removed SmallVector completelyHenry Wilson
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-02-02Codechange: Convert saveload numbers to enum values.Peter Nelson
(This was mostly achieved with a few in-place regexes)
2019-02-02Codechange: Make saveload version upper bound exclusive, i.e. version object ↵Peter Nelson
was removed instead of version object last appeared.
2018-10-31Doc: Lots and lots of doxymentation fixesCharles Pigott
2015-03-07(svn r27178) -Fix [FS#5969]: Data race due to lazy initialisation of objects.frosch
2014-06-14(svn r26646) -Fix [FS#6041]: Save locations instead of distances in link ↵fonsinchen
graphs to reduce size.
2014-05-16(svn r26589) -Fix: SIGSEGV on all big endian architectures that tried to ↵rubidium
load e.g. the 1.4 intro game or anything else with more than 0 linkgraph nodes that was saved on little endian
2014-04-23(svn r26482) -Codechange: add an include that allows us to undefine/redefine ↵rubidium
"unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values
2013-10-22(svn r25898) -Codechange: Add second timestamp for 'restricted links' to all ↵fonsinchen
edges.
2013-10-22(svn r25897) -Fix: Dates are int32, not uint32, and should be saved as such.fonsinchen
2013-06-09(svn r25358) -Codechange: save and load link graph jobs and the schedulefonsinchen
2013-05-19(svn r25258) -Codechange: save linkgraph (fonsinchen)rubidium