Commit Graph

104 Commits (580d0a6343549f7706a7dac4509e8e2f1c9f66f9)

Author SHA1 Message Date
Rubidium 580d0a6343 Codechange: make use of Tile in for all direct map accesses 1 year ago
Jonathan G Rennison 4c1406a4b5 Add: NewGRF road stops 1 year ago
Rubidium 3c54344825 Fix: comparison of narrow type with wide type in loop condition
Technically this can't be triggered with the currently returned values though.
1 year ago
Peter Nelson 22803f997b Codechange: Use std::vector for station speclist
This removes manual memory allocation, although we still manage the list
size in roughly the same way.
2 years ago
glx22 6e627f35ac Cleanup: Remove now unneeded ChunkHandler members 3 years ago
glx22 2c941cd8b3 Codechange: Use ChunkHandlers sub-classes 3 years ago
glx22 c1a9fe6fbd Codechange: Use static array of references to ChunkHandler 3 years ago
Patric Stout 3826703bc3 Add: store headers for chunks with SL_STRUCTLIST 3 years ago
Patric Stout cdb3dd0493 Add: store headers for most savegame chunks
When a header is added, the chunk changes from CH_ARRAY type to
CH_TABLE type.
3 years ago
Patric Stout 7dd5fd6ed4 Feature: framework to make savegames self-descriptive
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.
3 years ago
Patric Stout 8e91527251 Codechange: mark chunks that are not stored as CH_READONLY
This makes it easier to spot chunks that have a save_proc that
is a nullptr, but also prevents confusion, where it looks like
the CH_ type of a chunk has influence on how it is being read.
It is not, it is only used for saving.
3 years ago
Patric Stout a146bcfe93 Change: store length of SL_STRUCTLIST in the savegame
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.
3 years ago
Patric Stout aa02bf27f6 Codechange: use as much of STNN code for STNS as possible
There was a lot of code duplication for no real reason. Now with
SLEG_STRUCT support, we can just re-use the code, hopefully making
it easier for future-us to make changes to this, without breaking
everything for old games.
3 years ago
Patric Stout 0bdca02bdf Codechange: use SLE_STRUCT(LIST) for Station chunks 3 years ago
Patric Stout 4e4720f217 Codechange: remove the special station/vehicle code from SaveLoad
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.
3 years ago
Patric Stout 8f323855b1 Codechange: rename SL_LST to SL_REFLIST to highlight the "reference" part
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.
3 years ago
glx22 c27afdf3f6 Codechange: Remove FOR_ALL_CHUNK_HANDLERS
Co-Authored-By: Patric Stout <truebrain@openttd.org>
3 years ago
Patric Stout 9fff00ba20
Codechange: C++-ify lists for SaveLoad (#9323)
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.
3 years ago
glx22 38c97e1492 Codechange: Replace TILE_AREA_LOOP with range-based for loops 3 years ago
Michael Lutz 63ccb36ef3 Codechange: Use std::string for most of the user-settable custom names. 4 years ago
glx bc8333723c Fix #8021: limit savegame range for docking tiles fixing 4 years ago
SamuXarick 57553cd809 Fix #8020: Add missing docking tiles around industry neutral stations 4 years ago
glx b91abd3af9 Codechange: Replace FOR_ALL_ROADSTOPS with range-based for loops 5 years ago
glx d8a1be48cd Codechange: Replace vehicle related FOR_ALL with range-based for loops 5 years ago
glx 9892d90b26 Codechange: Replace order related FOR_ALL with range-based for loops 5 years ago
glx ddabfed1cd Codechange: Replace station related FOR_ALL with range-based for loops 5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
peter1138 f538179878 Feature: Multi-tile docks and docking points. 5 years ago
peter1138 4f052fc2a4 Cleanup: Fix alignment after NULL -> nullptr change. 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Peter Nelson e21ade375e Codechange: Change from numeric to descriptive SLV enum labels for last entries. 5 years ago
Peter Nelson 9de12521ec Codechange: Convert saveload numbers to enum values.
(This was mostly achieved with a few in-place regexes)
5 years ago
Peter Nelson ea4ea62816 Codechange: Make saveload version upper bound exclusive, i.e. version object was removed instead of version object last appeared. 5 years ago
Peter Nelson 67633606b0 Codechange: Remove value mangling and field misuse in SLE_WRITEBYTE.
The original translation functionality hasn't been used since 2007.
5 years ago
Michael Lutz 4b0b4e0643 Feature: [NewGRF] Increase size of persistent storage to 256. 6 years ago
PeterN 11ab3c4ea2
Change: Increase cargo type limit to 64. 6 years ago
fonsinchen 4e13285274 (svn r27770) -Fix [FS#6540]: Initialize variables in station_sl.cpp (JGR) 7 years ago
rubidium 982f5a6aa2 (svn r26878) -Change: move m6 to TileExtended to keep Tile 8 bytes and thus better alignable 10 years ago
rubidium 134ad63b80 (svn r26753) -Fix: desync due to not always properly restoring game state from the savegame 10 years ago
rubidium 89c25b955e (svn r26580) -Codechange: s/GES_PICKUP/GES_RATING/ (it has nothing to do with actual pickup), s/acceptance_pickup/status/ (the enum isn't called GoodEntryStatus for a reason; it's not only acceptance and pickup anymore) 10 years ago
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 10 years ago
frosch 49852e3dac (svn r26175) -Add: Log in desync output when persistent storage is discarded. 11 years ago
rubidium b3e93d6520 (svn r26057) -Fix: a number of possibly uninitialised variables 11 years ago
fonsinchen 6524849386 (svn r25899) -Change: Restrict flows if links are restricted and don't normally pick them anymore. 11 years ago
fonsinchen 741c431caa (svn r25362) -Feature: consider cargo waiting at other stations for rating at the origin station 11 years ago
fonsinchen 04e3eb6fab (svn r25361) -Feature: distribute cargo according to plan given by linkgraph 11 years ago
fonsinchen a2ff96d682 (svn r25360) -Codechange: save and load flow stats 11 years ago
fonsinchen 16307a8a6f (svn r25337) -Fix: saving only 8 bits of 16 causes endianness problems 11 years ago
rubidium f292a87dc4 (svn r25312) -Fix-ish: missing spaces after comma + realignment of tables; quite boring with -x -w 11 years ago
rubidium cdb0a76958 (svn r25012) -Codechange: persistently keep 'reserved' cargo (for full-load improved loading) instead of calculating if for every cycle 11 years ago