Commit Graph

67 Commits

Author SHA1 Message Date
Rubidium fe2bcd2a58 Codechange: migrate size related functions to Map structure 2023-01-21 17:11:40 +01:00
glx22 6e627f35ac Cleanup: Remove now unneeded ChunkHandler members 2021-07-06 22:29:08 +02:00
glx22 2c941cd8b3 Codechange: Use ChunkHandlers sub-classes 2021-07-06 22:29:08 +02:00
glx22 c1a9fe6fbd Codechange: Use static array of references to ChunkHandler 2021-07-06 22:29:08 +02:00
Patric Stout 3e3049fd0e Codechange: make savegame-version checks more obvious in SlCompanyLiveries::Load
num_liveries indirectly contained the same information, but this
makes reading these things pretty difficult. So use IsSavegameVersionBefore()
like everywhere else instead.
2021-07-02 22:21:58 +02:00
Patric Stout 3826703bc3 Add: store headers for chunks with SL_STRUCTLIST 2021-07-02 22:21:58 +02:00
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.
2021-07-02 22:21:58 +02:00
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.
2021-06-15 16:45:04 +02:00
Patric Stout af43fc3d62 Codechange: use SLE_STRUCT(LIST) for Company chunks 2021-06-14 21:58:05 +02:00
glx22 c27afdf3f6 Codechange: Remove FOR_ALL_CHUNK_HANDLERS
Co-Authored-By: Patric Stout <truebrain@openttd.org>
2021-06-06 19:35:06 +02:00
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.
2021-05-31 22:26:44 +02:00
glx22 2feb801e56 Codechange: Replace FOR_ALL_ROADTRAMTYPES with range-based for loops 2021-05-03 19:46:57 +02:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Michael Lutz 63ccb36ef3 Codechange: Use std::string for most of the user-settable custom names. 2020-05-21 20:02:34 +02:00
glx ddabfed1cd Codechange: Replace station related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Peter Nelson e21ade375e Codechange: Change from numeric to descriptive SLV enum labels for last entries. 2019-02-02 21:39:06 +00:00
Peter Nelson 9de12521ec Codechange: Convert saveload numbers to enum values.
(This was mostly achieved with a few in-place regexes)
2019-02-02 21:39:06 +00:00
Peter Nelson ea4ea62816 Codechange: Make saveload version upper bound exclusive, i.e. version object was removed instead of version object last appeared. 2019-02-02 21:39:06 +00:00
PeterN 23960d0f2c Feature: Group liveries, and livery window usability enhancements. (#7108)
* Change: Replace checkbox in livery selection window with Default option in drop down selection.

This reduces clutter in the UI and allows for primary/secondary colours to independently follow the default scheme if desired.

* Feature: Add vehicle group liveries.
2019-01-31 14:57:44 +01:00
Charles Pigott 5f86e1a390 Codechange: Silence -Wclass-memaccess warnings with GCC8 2018-06-27 22:54:46 +02:00
PeterN 11ab3c4ea2
Change: Increase cargo type limit to 64. 2018-06-26 13:32:58 +01:00
PeterN 42b43c9983
Change: Available railtypes is always calculated on load, so no need to load value for old savegames (#6782) 2018-05-19 22:31:46 +01:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
frosch fc4c4d080c (svn r27757) -Change: Make StringID 32bit. 2017-02-26 19:41:14 +00:00
frosch a56e2bccd0 (svn r27756) -Codechange: Add StringTab enum 2017-02-26 19:40:53 +00:00
frosch 9ad09627ad (svn r27754) -Codechange: Add GetStringTab(), GetStringIndex() and MakeStringID() to access the structure of StringIDs. 2017-02-26 19:39:58 +00:00
rubidium 191fd09d32 (svn r26590) -Fix: possible desync (big/little endian) due to not writing complete variables upon saveload 2014-05-16 17:39:35 +00:00
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 2014-04-23 20:13:33 +00:00
planetmaker f2e94237fc (svn r24619) -Change: Check for bankruptcy on a monthly basis (ZxBioHazardZx) 2012-10-20 22:05:26 +00:00
michi_cc f3e295b4ec (svn r24134) -Add: Configurable limits for tree planting. 2012-04-17 19:43:52 +00:00
frosch 07f69d8b88 (svn r23920) -Fix: Consider only the middle tile of a lock for lock-infrastructure costs. The other two tiles may be owned by other companies. Also do not count the middle tile of a lock as canal, independent of whether it is build on ground or river slope. 2012-02-09 22:38:39 +00:00
michi_cc 52b951ca6f (svn r23844) -Fix (r23414): Infrastructure count for stations wasn't updated properly on company takeover. And don't count buoys while loading a game either. 2012-01-22 22:21:21 +00:00
rubidium 70c7fbd90e (svn r23826) -Fix [FS#4972]: the detailed performance rating window showed the cargo count of the current quarter instead of the last quarter like the tooltip says 2012-01-20 20:18:19 +00:00
rubidium 6d6be50ae0 (svn r23740) -Codechange: remove some 300 unneeded includes from the .cpp files 2012-01-03 21:32:51 +00:00
truebrain 102f811d02 (svn r23636) -Add: introduce ScriptText in parameters where it can be used 2011-12-19 21:06:06 +00:00
michi_cc f98312eb77 (svn r23414) -Add: Company infrastructure counts for stations/airports. 2011-12-03 23:40:30 +00:00
michi_cc c06bbb4863 (svn r23413) -Add: Company infrastructure counts for canals. 2011-12-03 23:40:23 +00:00
michi_cc a29a9d94b7 (svn r23412) -Add: Company infrastructure counts for road. 2011-12-03 23:40:18 +00:00
michi_cc d30fcd4e35 (svn r23411) -Add: Company infrastructure counts for rail. 2011-12-03 23:40:13 +00:00
rubidium 73a3708a9e (svn r22958) -Fix [FS#4778]: the savegame description and loading of savegames would crash with savegames from a patched stable (which didn't bump the savegame version) 2011-09-23 19:49:45 +00:00
rubidium 81074e0ca2 (svn r22737) -Fix [FS#4717]: some corrupted savegames could crash OpenTTD instead of showing the "savegame corrupted" message 2011-08-12 18:36:47 +00:00
rubidium eab47d2227 (svn r21728) -Fix/Feature [FS#4331]: (configurably) limit amount of tiles that can be cleared/terraformed by a company 2011-01-04 22:50:09 +00:00
alberth 3e27739287 (svn r21284) -Codechange: Rename CheckSavegameVersion() to IsSavegameVersionBefore(). 2010-11-21 12:47:04 +00:00
rubidium 30f2afac9b (svn r20632) -Cleanup: remove "a few" unneeded includes, and add them to some headers 2010-08-26 22:01:16 +00:00
yexo dff871b40d (svn r20311) -Codechange: don't reserve extra space in the savegame that is never used 2010-08-02 18:24:09 +00:00
frosch 58f2a1d014 (svn r19985) -Fix (r19980): Loading preview data from old savegames failed indeterministically due to non-zeroed memory allocation. Thanks smatz. 2010-06-13 14:52:42 +00:00