Commit Graph

371 Commits (3e625b5b1a81b00f774ca87b48d3e4f4e9d014c3)

Author SHA1 Message Date
Patric Stout 3e625b5b1a
Add: track savegame size to report with survey (#12304) 3 months ago
Rubidium e67fc33172 Codechange: Add support for NULL strings in SaveLoadCompat 3 months ago
Loïc Guilloux 3ffa176870
Change: [Script] Store randomizers in savegame (#12063) 4 months ago
Rubidium 7a740eefa0 Codechange: use std::unique_ptr for managing SaveLoadParams 4 months ago
Rubidium 4b372b6050 Codechange: use std::shared_ptr to manage saveload filters instead of manually trying to avoid double frees 4 months ago
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 4 months ago
Tyler Trahan 2b1f78d2ca
Fix: Use alternate timekeeping units in savegame title (#11912) 4 months ago
Kuhnovic f1e999ec59
Feature: Region-based pathfinder for ships (#10543) 5 months ago
Peter Nelson 10f94fb0dd Codechange: Remove runtime variable size assertion. 6 months ago
frosch a7707302e6 Codechange: silence false warning. 9 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
11 months ago
Rubidium 97dd84d1e0 Codechange: move saveload string fixing code to saveload 12 months ago
Rubidium 9408ab4799 Codechange: only one '\0' is required 12 months ago
Rubidium 55dfca1936 Codechange: replace seprintf with C++ style formatting 1 year ago
Rubidium 993f90b6a0 Codechange: let GenerateDefaultSaveName return std::string 1 year ago
Rubidium d9f8a4c380 Codechange: use std::string GetString variant 1 year ago
axet 60540f7df6 Change: Allow dedicated server to use threaded saves. (#10787)
Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
1 year ago
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 1 year ago
Rubidium e9c03f0dad Cleanup: remnants of C-style strings in saveload 1 year ago
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
1 year ago
Tyler Trahan 6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 1 year ago
Patric Stout 018a26d9b6
Fix: crash in emscripten when saving games (#10758)
Don't allocate 128KB on stack, but rather on the heap.
1 year ago
Peter Nelson 00bf42353a Codechange: Place gamelog into its own class, along with internal data.
Data is now stored in vectors to avoid manual memory management and
passing lengths around.
1 year ago
Rubidium 1f3b7e2efd Codechange: use std::string instead of stredup for saveload error messages 1 year ago
Rubidium ee723f26ba Codechange: Make FileToSaveLoad's title std::string and simplify assignments 1 year ago
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 1 year ago
Charles Pigott b282664242 Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives 1 year ago
Charles Pigott ce24709576 Add: Some additional debugging information when chunk sizes are incorrect 1 year ago
Charles Pigott 8aea13a85b Codechange: Use fmt for SlErrorCorruptFmt 1 year ago
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 1 year ago
rubidium42 1951af07c0 Codechange: do not hide parameters with local variables 1 year ago
PeterN 961e66df30
Fix #10224: Don't fiddle with fast-forward when saving. (#10230)
The original comment about saving with fast-forward on was written 18 years
ago, and predates lots of changes to how saveload work.
1 year ago
Loïc Guilloux 4f9893cc98
Fix 55a1171: Restore skipping of "colour" character (#10244) 1 year ago
dP 5e14a20b3b
Feature: [GS] Scriptable league tables (#10001) 2 years ago
Loïc Guilloux 460991ecf4
Feature: Persistant rotation of numbered auto/netsave after restart (#9397)
It was always starting from 0 on openttd restart.
Now the most recent auto/netsave number will be used as a base to generate the next filename.
3 years ago
Stephan a70aa5df49
Add #9188: netsave now keeps multiple version around, similar to autosave (#9395) 3 years ago
Patric Stout c1f13e0372
Fix: reduce the amount of debug messages on -dsl=2 (#9420)
LoadCheck makes it sound like something is really broken while
loading savegames, while it really is perfectly normal, as most
chunks do not implement LoadCheck.
3 years ago
glx22 6e627f35ac Cleanup: Remove now unneeded ChunkHandler members 3 years ago
glx22 c1a9fe6fbd Codechange: Use static array of references to ChunkHandler 3 years ago
glx22 f371a5ad70 Codechange: Preparation for ChunkHandler subclassing 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 b9ab9e4d05 Codechange: add the ability to save/load a std::vector
std::vector<bool> is not possible, as .. that is a nice special
case in C++.

This new type will be used in next commit.
3 years ago
Patric Stout 97b94bdc9a Change: prefix SL_ARR with the length of the array
This means that during loading we can validate that what is saved
is also that what is expected. Additionally, this makes all list
types similar to how they are stored on disk:
First a gamma to indicate length, followed by the data.
The size still depends on the type.
3 years ago
Patric Stout f67af5cbe5 Codechange: make it more obvious SlArray supports SLE_VAR_NULL
In the end, the code was already doing the right thing, but a few
functions deep, and not really obvious. When validating what objects
can handle SLE_VAR_NULL, it is nicer to just have this obvious.
3 years ago
Patric Stout d5cda58158 Codechange: use SL_NULL if you want to store null-bytes or load to nothing
Using SL_ARR for this gives us a bit of trouble later on, where we
add a length-field to SL_ARR. This of course is not the intention
of SLE_CONDNULL. So better seperate it.
3 years ago
Patric Stout 0d2e3437e3 Change: switch SL_DEQUE and SL_REFLIST length field to a gamma
The current SaveLoad is a bit inconsistent how long a length field
is. Sometimes it is a 32bit, sometimes a gamma. Make it consistent
across the board by making them all gammas.
3 years ago
Patric Stout 75e7451151 Change: indicate in the savegame if a SL_STRUCT contains any data
This helps external tooling to understand if a SL_STRUCT should
be skipped when reading. Basically, this transforms an SL_STRUCT
into a SL_STRUCTLIST with either 0 or 1 length.
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