summaryrefslogtreecommitdiff
path: root/src/saveload/saveload.h
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-10Feature: Configurable subsidy durationTyler Trahan
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: 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: merge guiflags and flags in settings .ini filesPatric Stout
It was rather confusing which one was for what, especially as some SaveLoad flags were settings-only. Clean up this mess a bit by having only Setting flags.
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: remove the unused SLF_HEX flagPatric Stout
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-13Codechange: clean up C-string support from settingsrubidium42
2021-05-13Codechange: move misc settings to std::stringrubidium42
2021-05-08Change: Use gender-neutral pronouns in console command messages (and ↵William Davis
comments) (#9203)
2021-04-22Feature: Per-group wagon removal flag.peter1138
2021-03-26Fix: store the recent new game_creation settings in savegamesPatric Stout
This allows us to later on see what someone did, and makes sure that "restart" command still knows how the game was created.
2021-03-14Change: Heading for 1.12 now (#8862)Patric Stout
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.
2021-01-22Feature: Allow GameScripts to add additional text to Industry view windowdP
2021-01-18Fix #8589, 653e7fa548: Motion counter is NewGRF-visible but not saved, ↵Michael Lutz
leading to desyncs. (#8591)
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-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-22Feature: Set exclusive access to industry from GS (#8115)Pavel Stupnikov
2020-12-22Feature: Influence industry production changes from GS (#7912)Niels Martin Hansen
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-06Fix: do not add an offset to a nullptrPatric Stout
This is, by specs, undefined behaviour. See https://reviews.llvm.org/D67122 In cases where this is done, optimizations done by LLVM can generate code that causes crashes. GetVariableAddress() had two (legit) ways this could happen: - For SaveLoad set to global - For SaveLoad set to SLE_VAR_NULL, where sld->address is always a nullptr, and object could or could not be a nullptr.
2020-07-27Codechange #8258: Remove unused town cargo caches from the savegamedP
2020-06-28Revert #8157: Redundant changedP
2020-06-28Fix: Incorrect save/load array size of Town::cargo_acceptedJonathan G Rennison
In 11ab3c4e the number of cargo types was changed from 32 to 64. The save/load of Town::cargo_accepted was not updated, such that only half of the data structure is saved/loaded in savegame versions 199 to 218. Discard and regenerate data from all savegame versions prior to 219.
2020-06-28Codechange: Move SlSkipBytes to saveload.hJonathan G Rennison
2020-06-27Codechange: Add WARN_FORMAT to vseprintf and fix the cascade of warnings ↵Charles Pigott
that followed
2020-05-21Codechange: Store GS lang texts in std::strings.Michael Lutz
2020-05-06Fix: reset roadtype/streetcartype info for non-road bridgesYexo
2020-02-08Change: Heading for 1.11 nowglx
2020-02-06Feature: SLF_HEX to print hexadecimal numbers in the config fileJohannes E. Krause
2019-12-28Feature: Configurable game ending yearNiels Martin Hansen
Functionally reverts 683b65ee1
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-10-19Fix: Bump savegame versionJack Baron
2019-09-29Fix: Some typos found using codespellJMcKiern
2019-06-30Feature: Multi-tile docks and docking points.peter1138
2019-05-11Change: Limit memory allocations for each Squirrel instanceNiels Martin Hansen
This can avoid out-of-memory situations due to single scripts using up the entire address space. Instead, scripts that go above the maximum are killed. The maximum is default 1 GB per script, but can be configured by a setting.
2019-05-01Feature: Add NotRoadTypes (NRT)peter1138
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-03-24Change: Bump savegame version for tree tile water class conversion.Peter Nelson
2019-03-16Remove: OPFCharles Pigott
2019-03-08Add: Road vehicle path cache. (#7261)PeterN
2019-03-08Feature: Industries with neutral stations (e.g. Oil Rig) only supply/accept ↵PeterN
cargo to/from their neutral station. (#7234) This change is a controlled by a game setting, located under Environment -> Industries which allows toggling the behaviour. It defaults to enabled. "Company stations can serve industries with attached neutral stations" When enabled, industries with attached neutral station (such as Oil Rigs) may also be served by company-owned stations built nearby. This is the traditional behaviour. When disabled, these industries may only be served by their neutral station. Any nearby company-owned stations won't be able to serve them, nor will the neutral station serve anything else other than the industry.
2019-03-08Change: Add configurable curve penalty for ships.Peter Nelson
2019-03-04Add: Option for population-linear town cargo generationNiels Martin Hansen
Introduce a new default algorithm for town cargo generation (passengers and mail), and a game setting to choose between the new and original algorithm. The original town cargo generation algorithm has the property of the generated amount relating to the square of each building's population, meaning large towns easily produce more cargo than can realistically be transported. The problem is excessive cargo is amplified if playing with cargodist. The new algorithm introduced instead has a linear relation to the population. The result is that smaller towns will produce slightly more cargo, while the largest towns will produce about a fourth of what they would with the original algorithm. Existing savegames will use the original algorithm, while new games will default to the new algorithm.