summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-18 11:34:03 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-18 12:29:24 +0100
commit7e79dbfedfc019b269139b5308e4811938b75278 (patch)
treeac441403afa8da5b6586d963e79f636f7bcef2bf
parentec4f8323fe075e8b8d716128996658a2a1a300d7 (diff)
compat: remove integer-types header
Other headers incldue <cstddef> and <cstdint> anyway.
-rw-r--r--compat/assert.hpp1
-rw-r--r--compat/int-hash.hpp2
-rw-r--r--compat/integer-types.hpp59
-rw-r--r--editor/editor-enums.hpp5
-rw-r--r--editor/editor.hpp3
-rw-r--r--editor/keys.hpp3
-rw-r--r--editor/tile-editor.hpp2
-rw-r--r--entity/entity.hpp2
-rw-r--r--entity/types.hpp2
-rw-r--r--floormat/events.hpp2
-rw-r--r--floormat/main.hpp1
-rw-r--r--loader/texture.cpp1
-rw-r--r--serialize/binary-serializer.hpp6
-rw-r--r--src/anim.hpp1
-rw-r--r--src/precomp.hpp1
-rw-r--r--src/random.hpp4
-rw-r--r--src/scenery.hpp2
-rw-r--r--src/tile-defs.hpp4
-rw-r--r--src/tile-image.hpp2
-rw-r--r--src/tile-iterator.hpp4
-rw-r--r--src/tile.hpp3
-rw-r--r--src/world.hpp3
22 files changed, 27 insertions, 86 deletions
diff --git a/compat/assert.hpp b/compat/assert.hpp
index 0953ad90..0afd0772 100644
--- a/compat/assert.hpp
+++ b/compat/assert.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include "defs.hpp"
#include <cstdio>
#include <type_traits>
diff --git a/compat/int-hash.hpp b/compat/int-hash.hpp
index ee2dbf16..43b92605 100644
--- a/compat/int-hash.hpp
+++ b/compat/int-hash.hpp
@@ -1,5 +1,5 @@
#pragma once
-#include "integer-types.hpp"
+#include <cstddef>
namespace floormat {
diff --git a/compat/integer-types.hpp b/compat/integer-types.hpp
deleted file mode 100644
index 6411599f..00000000
--- a/compat/integer-types.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#pragma once
-
-#ifdef _MSC_VER
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-typedef __int64 ptrdiff_t;
-typedef __int64 intptr_t;
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int size_t;
-typedef int ptrdiff_t;
-typedef int intptr_t;
-typedef unsigned int uintptr_t;
-#endif
-typedef signed char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long long int64_t;
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-#elif __GNUG__
-typedef __SIZE_TYPE__ size_t;
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
-typedef __INTPTR_TYPE__ intptr_t;
-typedef __UINTPTR_TYPE__ uintptr_t;
-
-typedef __INT8_TYPE__ int8_t;
-typedef __INT16_TYPE__ int16_t;
-typedef __INT32_TYPE__ int32_t;
-typedef __INT64_TYPE__ int64_t;
-typedef __UINT8_TYPE__ uint8_t;
-typedef __UINT16_TYPE__ uint16_t;
-typedef __UINT32_TYPE__ uint32_t;
-typedef __UINT64_TYPE__ uint64_t;
-#else
-#define FM_NO_INTTYPES_FORWARD_DECLARATION
-#include <cstddef>
-#include <cstdint>
-#endif
-
-#ifndef FM_NO_INTTYPES_FORWARD_DECLARATION
-namespace std {
-using ::size_t;
-using ::ptrdiff_t;
-using ::intptr_t;
-using ::uintptr_t;
-
-using ::int8_t;
-using ::int16_t;
-using ::int32_t;
-using ::int64_t;
-using ::uint8_t;
-using ::uint16_t;
-using ::uint32_t;
-using ::uint64_t;
-} // namespace std
-#endif
diff --git a/editor/editor-enums.hpp b/editor/editor-enums.hpp
index e7e83faf..3806674f 100644
--- a/editor/editor-enums.hpp
+++ b/editor/editor-enums.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include "compat/integer-types.hpp"
namespace floormat {
@@ -7,11 +6,11 @@ enum class editor_mode : unsigned char {
none, floor, walls, scenery,
};
-enum class editor_wall_rotation : std::uint8_t {
+enum class editor_wall_rotation : unsigned char {
N, W,
};
-enum class editor_snap_mode : std::uint8_t {
+enum class editor_snap_mode : unsigned char {
none = 0,
horizontal = 1 << 0,
vertical = 1 << 1,
diff --git a/editor/editor.hpp b/editor/editor.hpp
index 1093aa8d..bcbc26d1 100644
--- a/editor/editor.hpp
+++ b/editor/editor.hpp
@@ -1,6 +1,5 @@
#pragma once
#include "compat/defs.hpp"
-#include "compat/integer-types.hpp"
#include "global-coords.hpp"
#include "tile-image.hpp"
#include "scenery.hpp"
@@ -29,7 +28,7 @@ struct editor final
tile_editor* current_tile_editor() noexcept;
const tile_editor* current_tile_editor() const noexcept;
- enum class button : std::uint8_t { none, place, remove, };
+ enum class button : unsigned char { none, place, remove, };
void on_click(world& world, global_coords pos, int mods, button b);
void on_click_(world& world, global_coords pos, button b);
diff --git a/editor/keys.hpp b/editor/keys.hpp
index 611f78e1..12b96f27 100644
--- a/editor/keys.hpp
+++ b/editor/keys.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include "compat/integer-types.hpp"
namespace floormat {
@@ -12,7 +11,7 @@ enum kmod : int {
kmod_mask = kmod_shift | kmod_ctrl | kmod_alt | kmod_super,
};
-enum key : std::uint32_t {
+enum key : unsigned {
key_noop,
key_camera_up, key_camera_left, key_camera_right, key_camera_down, key_camera_reset,
key_rotate_tile,
diff --git a/editor/tile-editor.hpp b/editor/tile-editor.hpp
index 9f4bb2db..4569bfee 100644
--- a/editor/tile-editor.hpp
+++ b/editor/tile-editor.hpp
@@ -15,7 +15,7 @@ struct world;
struct tile_editor final
{
private:
- enum selection_mode : std::uint8_t {
+ enum selection_mode : unsigned char {
sel_none, sel_tile, sel_perm,
};
diff --git a/entity/entity.hpp b/entity/entity.hpp
index 1dedebf0..4eca858e 100644
--- a/entity/entity.hpp
+++ b/entity/entity.hpp
@@ -1,8 +1,8 @@
#pragma once
#include "name-of.hpp"
-#include "compat/integer-types.hpp"
#include "accessor.hpp"
#include "util.hpp"
+#include <cstddef>
#include <concepts>
#include <compare>
#include <type_traits>
diff --git a/entity/types.hpp b/entity/types.hpp
index 88391725..055f6de0 100644
--- a/entity/types.hpp
+++ b/entity/types.hpp
@@ -9,7 +9,7 @@ using StringView = BasicStringView<const char>;
namespace floormat::entities {
-enum class erased_field_type : std::uint32_t {
+enum class erased_field_type : unsigned {
none,
string,
u8, u16, u32, u64, s8, s16, s32, s64,
diff --git a/floormat/events.hpp b/floormat/events.hpp
index 597c89b2..a70832fd 100644
--- a/floormat/events.hpp
+++ b/floormat/events.hpp
@@ -3,7 +3,7 @@
namespace floormat {
-enum mouse_button : std::uint8_t {
+enum mouse_button : unsigned char {
mouse_button_none = 0,
mouse_button_left = 1 << 0,
mouse_button_middle = 1 << 1,
diff --git a/floormat/main.hpp b/floormat/main.hpp
index 9347ad40..acd1bfdc 100644
--- a/floormat/main.hpp
+++ b/floormat/main.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "compat/defs.hpp"
#include "src/global-coords.hpp"
#include <Magnum/Math/Vector2.h>
diff --git a/loader/texture.cpp b/loader/texture.cpp
index 27998f84..e9d1f33e 100644
--- a/loader/texture.cpp
+++ b/loader/texture.cpp
@@ -1,5 +1,6 @@
#include "impl.hpp"
#include "compat/assert.hpp"
+#include "compat/defs.hpp"
#include "compat/alloca.hpp"
#include <cstring>
#include <Corrade/Utility/Path.h>
diff --git a/serialize/binary-serializer.hpp b/serialize/binary-serializer.hpp
index 66281cc1..3d39880c 100644
--- a/serialize/binary-serializer.hpp
+++ b/serialize/binary-serializer.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "compat/integer-types.hpp"
-#include "compat/defs.hpp"
+#include <cstddef>
+#include <cstdint>
#include <bit>
#include <concepts>
#include <type_traits>
@@ -17,7 +17,7 @@ namespace floormat::Serialize {
static_assert(std::endian::native == std::endian::big || std::endian::native == std::endian::little);
-enum class value_type : std::uint8_t {
+enum class value_type : unsigned char {
none, uc, u8, u16, u32, u64,
f32, f64,
COUNT
diff --git a/src/anim.hpp b/src/anim.hpp
index 447c0410..1a4011dc 100644
--- a/src/anim.hpp
+++ b/src/anim.hpp
@@ -1,6 +1,5 @@
#pragma once
-#include "compat/integer-types.hpp"
#include <vector>
#include <Corrade/Containers/String.h>
#include <Magnum/Magnum.h>
diff --git a/src/precomp.hpp b/src/precomp.hpp
index bdd5a380..4808d6a2 100644
--- a/src/precomp.hpp
+++ b/src/precomp.hpp
@@ -1,6 +1,5 @@
#pragma once
-#include "compat/integer-types.hpp"
#include "compat/defs.hpp"
#include "compat/assert.hpp"
#include "compat/alloca.hpp"
diff --git a/src/random.hpp b/src/random.hpp
index 5b6dc6a9..e8e462e8 100644
--- a/src/random.hpp
+++ b/src/random.hpp
@@ -1,5 +1,7 @@
#pragma once
-#include "compat/integer-types.hpp"
+
+#include <cstddef>
+#include <cstdint>
#include <concepts>
#include <type_traits>
diff --git a/src/scenery.hpp b/src/scenery.hpp
index 5056a22e..3e7c4e4f 100644
--- a/src/scenery.hpp
+++ b/src/scenery.hpp
@@ -1,5 +1,5 @@
#pragma once
-#include "compat/integer-types.hpp"
+#include <cstdint>
#include <memory>
namespace floormat {
diff --git a/src/tile-defs.hpp b/src/tile-defs.hpp
index af0b0194..f40e81ff 100644
--- a/src/tile-defs.hpp
+++ b/src/tile-defs.hpp
@@ -1,10 +1,10 @@
#pragma once
-#include "compat/integer-types.hpp"
+#include <cstddef>
#include <Magnum/Math/Vector3.h>
namespace floormat {
-constexpr inline std::uint8_t TILE_MAX_DIM = 16;
+constexpr inline unsigned char TILE_MAX_DIM = 16;
constexpr inline std::size_t TILE_COUNT = TILE_MAX_DIM*TILE_MAX_DIM;
constexpr inline auto TILE_MAX_DIM20d = Magnum::Math::Vector3<double> { TILE_MAX_DIM, TILE_MAX_DIM, 0 };
diff --git a/src/tile-image.hpp b/src/tile-image.hpp
index 2ecfd6d7..f1db9a5e 100644
--- a/src/tile-image.hpp
+++ b/src/tile-image.hpp
@@ -1,5 +1,5 @@
#pragma once
-#include "compat/integer-types.hpp"
+#include <cstdint>
#include <memory>
namespace floormat {
diff --git a/src/tile-iterator.hpp b/src/tile-iterator.hpp
index 6403b53a..f5f717f6 100644
--- a/src/tile-iterator.hpp
+++ b/src/tile-iterator.hpp
@@ -1,9 +1,11 @@
#pragma once
-#include "compat/integer-types.hpp"
#include "local-coords.hpp"
#include "tile.hpp"
+#include <cstddef>
+#include <iterator>
+
namespace floormat {
struct tile_iterator_tuple final { // NOLINT(cppcoreguidelines-pro-type-member-init)
diff --git a/src/tile.hpp b/src/tile.hpp
index 6fad4b30..dc635da6 100644
--- a/src/tile.hpp
+++ b/src/tile.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include "compat/defs.hpp"
#include "tile-image.hpp"
#include "scenery.hpp"
@@ -9,7 +8,7 @@ struct chunk;
struct anim_atlas;
// zero is the default, see bitset in chunk.hpp
-enum pass_mode : std::uint8_t { pass_shoot_through, pass_ok, pass_blocked, };
+enum pass_mode : unsigned char { pass_shoot_through, pass_ok, pass_blocked, };
struct pass_mode_ref final
{
diff --git a/src/world.hpp b/src/world.hpp
index 248f9dc4..69710bb6 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -1,8 +1,9 @@
#pragma once
#include "compat/int-hash.hpp"
-#include "compat/integer-types.hpp"
+#include "compat/defs.hpp"
#include "chunk.hpp"
#include "global-coords.hpp"
+#include <cstddef>
#include <unordered_map>
#include <memory>