diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-22 14:40:11 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-22 14:40:11 +0100 |
commit | b35f469d1a22d410fe0013edf865e2cb6e6de916 (patch) | |
tree | b3b1a385ba5dd32ca3de9b25a298db15bb28df83 /serialize | |
parent | 70b49d7abd466a8ab474643ed8d18e30bf17f25a (diff) |
w
Diffstat (limited to 'serialize')
-rw-r--r-- | serialize/savegame.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/serialize/savegame.cpp b/serialize/savegame.cpp index 9362d659..5a86bebd 100644 --- a/serialize/savegame.cpp +++ b/serialize/savegame.cpp @@ -344,6 +344,7 @@ ok: atlasid intern_string(StringView str) { string_array.reserve(vector_initial_size); + fm_assert(!str.find('\0')); auto [pair, fresh] = string_map.try_emplace(str, (uint32_t)string_array.size()); if (fresh) string_array.emplace_back(str); @@ -533,6 +534,12 @@ struct reader final : visitor_<reader> nchunks << s; } + StringView get_string(atlasid id) + { + fm_soft_assert(id < strings.size()); + return strings[id]; + } + void deserialize_strings_(binary_reader<const char*>& s) { fm_assert(strings.empty()); @@ -540,7 +547,6 @@ struct reader final : visitor_<reader> for (uint32_t i = 0; i < nstrings; i++) { auto str = s.read_asciiz_string_(); - Debug{} << "in" << str << str.size(); strings.emplace_back(str); } } |