summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-03 19:49:45 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-05 03:16:22 +0200
commit4d9f93857a7ff67f36bd52d9ae2adddadb142526 (patch)
treee09486e34dddfefe49eb91467c960d8e3e26018c
parent839ea792d7874d91c7524f4a857e8cd9d8488581 (diff)
c
-rw-r--r--serialize/old-savegame.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/serialize/old-savegame.cpp b/serialize/old-savegame.cpp
index 2e982af2..4d4aa25a 100644
--- a/serialize/old-savegame.cpp
+++ b/serialize/old-savegame.cpp
@@ -1,4 +1,5 @@
#include "binary-reader.inl"
+#include "compat/limits.hpp"
#include "src/world.hpp"
#include "src/scenery.hpp"
#include "src/critter.hpp"
@@ -54,11 +55,6 @@ using atlasid = uint16_t;
using chunksiz = uint16_t;
using proto_t = uint16_t;
-template<typename T> struct int_traits;
-
-template<std::unsigned_integral T> struct int_traits<T> { static constexpr T max = T(-1); };
-template<std::signed_integral T> struct int_traits<T> { static constexpr T max = T(-1)&~(T(1) << sizeof(T)*8-1); };
-
namespace {
constexpr inline proto_t proto_version = 19;
@@ -115,7 +111,7 @@ using namespace floormat::Serialize;
constexpr inline atlasid meta_short_scenery_bit_ = highbits<atlasid, 1, 0>;
constexpr inline atlasid meta_rotation_bits_ = highbits<atlasid, rotation_BITS, 1>;
constexpr inline atlasid scenery_id_flag_mask_ = meta_short_scenery_bit_ | meta_rotation_bits_;
-constexpr inline atlasid scenery_id_max_ = int_traits<atlasid>::max & ~scenery_id_flag_mask_;
+constexpr inline atlasid scenery_id_max_ = limits<atlasid>::max & ~scenery_id_flag_mask_;
struct reader_state final {
explicit reader_state(world& world, loader_policy policy) noexcept;