From 4766b404d5fa96fbb23a121cbe01336d1eb7dd29 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 13 Jan 2024 07:48:51 +0100 Subject: fix msvc --- compat/map.hpp | 9 --------- serialize/packbits.cpp | 8 ++++---- src/chunk-walls.cpp | 4 ++-- test/map.cpp | 4 ++++ 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/compat/map.hpp b/compat/map.hpp index 7983a805..3c1610d4 100644 --- a/compat/map.hpp +++ b/compat/map.hpp @@ -14,11 +14,6 @@ constexpr auto map0(const F& fun, const std::array& array, std::index_sequ return std::array { fun(array[Indexes])... }; } -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4996) -#endif - template [[deprecated("zero-length array!")]] CORRADE_ALWAYS_INLINE @@ -27,10 +22,6 @@ constexpr auto map0(const F&, const std::array&, std::index_sequence<>) return std::array, const std::remove_cvref_t&>>, 0>{}; } -#ifdef _MSC_VER -#pragma warning(pop) -#endif - } // namespace floormat::detail::map namespace floormat { diff --git a/serialize/packbits.cpp b/serialize/packbits.cpp index 701cc121..1428b203 100644 --- a/serialize/packbits.cpp +++ b/serialize/packbits.cpp @@ -12,10 +12,10 @@ constexpr bool test1() constexpr size_t bits[] = { 5, 2, 1, 0 }; constexpr size_t vals[] = { 3, 1, 0 }; - constexpr auto S0 = Storage{0b10111011uz}; - constexpr auto S1 = Storage{0b00000101uz}; - constexpr auto S2 = Storage{0b00000001uz}; - constexpr auto S3 = Storage{0b00000000uz}; + constexpr auto S0 = Storage{0b10111011}; + constexpr auto S1 = Storage{0b00000101}; + constexpr auto S2 = Storage{0b00000001}; + constexpr auto S3 = Storage{0b00000000}; using P0 = std::decay_t; using P1 = P0::next; diff --git a/src/chunk-walls.cpp b/src/chunk-walls.cpp index 74a975fb..98d12684 100644 --- a/src/chunk-walls.cpp +++ b/src/chunk-walls.cpp @@ -208,7 +208,7 @@ GL::Mesh chunk::make_wall_mesh() { const auto frames = atlas->frames(dir.top); auto variant = (variant_ != (uint8_t)-1 ? variant_ : vpos); - variant += !is_west ? frames.size() - 1 : 1; + variant += (uint8_t)(!is_west ? frames.size() - 1 : 1); variant = variant % frames.size(); constexpr Vector2 half_tile = TILE_SIZE2*.5f; constexpr float X = half_tile.x(), Y = half_tile.y(), Z = TILE_SIZE.z(); @@ -274,7 +274,7 @@ GL::Mesh chunk::make_wall_mesh() fm_assert(i < vertexes.size()); _walls->mesh_indexes[i] = (uint16_t)k; auto& v = vertexes[i]; - auto quad = get_quad(D, Group_::corner, Depth); + auto quad = get_quad(D, Group_::corner, (float)Depth); for (auto& v : quad) v += center; for (uint8_t j = 0; j < 4; j++) diff --git a/test/map.cpp b/test/map.cpp index 69c9942c..97007b73 100644 --- a/test/map.cpp +++ b/test/map.cpp @@ -2,6 +2,10 @@ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) // zero-length array +#endif + #include "compat/map.hpp" #include "compat/assert.hpp" -- cgit v1.2.3