diff options
author | Patric Stout <truebrain@openttd.org> | 2021-06-14 10:05:30 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-07-02 22:21:58 +0200 |
commit | 7dd5fd6ed497e1da40c13075d6e37b54ab12a082 (patch) | |
tree | 19f2e49e0e9ad714cec2fcf917dca954d33d8c0a /src/core | |
parent | 513641f9baaa732ab8000bc452a26284ae601f32 (diff) | |
download | openttd-7dd5fd6ed497e1da40c13075d6e37b54ab12a082.tar.xz |
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.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/span_type.hpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/span_type.hpp b/src/core/span_type.hpp index 394b9ef38..03bc678b7 100644 --- a/src/core/span_type.hpp +++ b/src/core/span_type.hpp @@ -73,6 +73,8 @@ public: typedef size_t size_type; typedef std::ptrdiff_t difference_type; + constexpr span() noexcept : first(nullptr), last(nullptr) {} + constexpr span(pointer data_in, size_t size_in) : first(data_in), last(data_in + size_in) {} template<class Container, typename std::enable_if<(is_compatible_container<Container, element_type>::value), int>::type = 0> |