diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-25 14:36:29 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-25 14:36:29 +0100 |
commit | 947a8d3ab773b539dfc18da20d8e5934b5ea9d62 (patch) | |
tree | f1a2ce5e913c8553a3fd6087a70f84f82c00669b /src | |
parent | 7d659dbe06cd8efc1d6eb4ef2c5fbc8ae27a4568 (diff) |
use operator""uz c++23 polyfill
Diffstat (limited to 'src')
-rw-r--r-- | src/anim-atlas.cpp | 10 | ||||
-rw-r--r-- | src/chunk-collision.cpp | 4 | ||||
-rw-r--r-- | src/chunk-render.cpp | 16 | ||||
-rw-r--r-- | src/chunk.cpp | 2 | ||||
-rw-r--r-- | src/entity.cpp | 4 | ||||
-rw-r--r-- | src/random.cpp | 2 | ||||
-rw-r--r-- | src/tile-atlas.cpp | 2 |
7 files changed, 20 insertions, 20 deletions
diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp index 64bdbdbc..f5370cb5 100644 --- a/src/anim-atlas.cpp +++ b/src/anim-atlas.cpp @@ -30,7 +30,7 @@ decltype(anim_atlas::_group_indices) anim_atlas::make_group_indices(const anim_d 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; const auto ngroups = a.groups.size(); - for (auto i = 0_uz; i < ngroups; i++) + for (auto i = 0uz; i < ngroups; i++) array[rotation_to_index(a.groups[i].name)] = uint8_t(i); return array; } @@ -140,10 +140,10 @@ void anim_atlas::make_bitmask_(const ImageView2D& tex, BitArray& array) fm_soft_assert(tex.pixelSize() == 4); fm_soft_assert(pixels.stride()[1] == 4); - for (auto j = 0_uz; j < height; j++) + for (auto j = 0uz; j < height; j++) { constexpr unsigned char amin = 32; - auto i = 0_uz; + auto i = 0uz; for (; i < width0; i += 8) { const auto src_idx = (j*stride + i*4)+3, dst_idx = (height-j-1)*width+i >> 3; @@ -189,7 +189,7 @@ rotation anim_atlas::next_rotation_from(rotation r) const noexcept for (auto i = size_t(r)+1; i < count; i++) if (_group_indices[i] != 0xff) return rotation(i); - for (auto i = 0_uz; i < count; i++) + for (auto i = 0uz; i < count; i++) if (_group_indices[i] != 0xff) return rotation(i); fm_abort("where did the rotations go?!"); @@ -216,7 +216,7 @@ bool anim_atlas::check_rotation(rotation r) const noexcept rotation anim_atlas::first_rotation() const noexcept { - for (auto i = 0_uz; i < rot_count; i++) + for (auto i = 0uz; i < rot_count; i++) if (_group_indices[i] == 0) return rotation(i); fm_abort("unreachable! can't find first rotation"); diff --git a/src/chunk-collision.cpp b/src/chunk-collision.cpp index 438b6a61..f0548df6 100644 --- a/src/chunk-collision.cpp +++ b/src/chunk-collision.cpp @@ -68,7 +68,7 @@ void chunk::ensure_passability() noexcept _add_bbox(box); } - for (auto i = 0_uz; i < TILE_COUNT; i++) + for (auto i = 0uz; i < TILE_COUNT; i++) { if (const auto* atlas = ground_atlas_at(i)) if (auto p = atlas->pass_mode(pass_mode::pass); p != pass_mode::pass) @@ -78,7 +78,7 @@ void chunk::ensure_passability() noexcept _rtree.Insert(min.data(), max.data(), id); } } - for (auto i = 0_uz; i < TILE_COUNT; i++) + for (auto i = 0uz; i < TILE_COUNT; i++) { auto tile = operator[](i); if (const auto* atlas = tile.wall_north_atlas().get()) diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp index 27a0367c..9d7787e3 100644 --- a/src/chunk-render.cpp +++ b/src/chunk-render.cpp @@ -13,7 +13,7 @@ template<size_t N = 1> static auto make_index_array(size_t max) { std::array<std::array<UnsignedShort, 6>, N*TILE_COUNT> array; // NOLINT(cppcoreguidelines-pro-type-member-init) - for (auto i = 0_uz; i < max; i++) + for (auto i = 0uz; i < max; i++) array[i] = tile_atlas::indices(i); return array; } @@ -25,7 +25,7 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple _ground_modified = false; size_t count = 0; - for (auto i = 0_uz; i < TILE_COUNT; i++) + for (auto i = 0uz; i < TILE_COUNT; i++) if (_ground_atlases[i]) ground_indexes[count++] = uint8_t(i); @@ -35,7 +35,7 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple }); std::array<std::array<vertex, 4>, TILE_COUNT> vertexes; - for (auto k = 0_uz; k < count; k++) + for (auto k = 0uz; k < count; k++) { const uint8_t i = ground_indexes[k]; const auto& atlas = _ground_atlases[i]; @@ -44,7 +44,7 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple const auto texcoords = atlas->texcoords_for_id(_ground_variants[i]); const float depth = tile_shader::depth_value(pos); auto& v = vertexes[k]; - for (auto j = 0_uz; j < 4; j++) + for (auto j = 0uz; j < 4; j++) v[j] = { quad[j], texcoords[j], depth }; } @@ -67,7 +67,7 @@ auto chunk::ensure_wall_mesh() noexcept -> wall_mesh_tuple _walls_modified = false; size_t count = 0; - for (auto i = 0_uz; i < TILE_COUNT*2; i++) + for (auto i = 0uz; i < TILE_COUNT*2; i++) if (_wall_atlases[i]) wall_indexes[count++] = uint16_t(i); @@ -77,7 +77,7 @@ auto chunk::ensure_wall_mesh() noexcept -> wall_mesh_tuple }); std::array<std::array<vertex, 4>, TILE_COUNT*2> vertexes; - for (auto k = 0_uz; k < count; k++) + for (auto k = 0uz; k < count; k++) { const uint16_t i = wall_indexes[k]; const auto& atlas = _wall_atlases[i]; @@ -88,7 +88,7 @@ auto chunk::ensure_wall_mesh() noexcept -> wall_mesh_tuple const float depth = tile_shader::depth_value(pos); const auto texcoords = atlas->texcoords_for_id(variant); auto& v = vertexes[k]; - for (auto j = 0_uz; j < 4; j++) + for (auto j = 0uz; j < 4; j++) v[j] = { quad[j], texcoords[j], depth, }; } @@ -180,7 +180,7 @@ auto chunk::ensure_scenery_mesh(Array<draw_entity>& array) noexcept -> scenery_m const float depth = tile_shader::depth_value(pos, tile_shader::scenery_depth_offset); scenery_vertexes.emplace_back(); auto& v = scenery_vertexes.back(); - for (auto j = 0_uz; j < 4; j++) + for (auto j = 0uz; j < 4; j++) v[j] = { quad[j], texcoords[j], depth }; } diff --git a/src/chunk.cpp b/src/chunk.cpp index 2c65ccae..21ebe800 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -25,7 +25,7 @@ bool chunk::empty(bool force) const noexcept { if (!force && !_maybe_empty) return false; - for (auto i = 0_uz; i < TILE_COUNT; i++) + for (auto i = 0uz; i < TILE_COUNT; i++) if (_ground_atlases[i] || _wall_atlases[i*2 + 0] || _wall_atlases[i*2 + 1] || !_entities.empty()) return _maybe_empty = false; if (!_entities.empty()) diff --git a/src/entity.cpp b/src/entity.cpp index 42ae5c4b..e0c060ff 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -112,7 +112,7 @@ Pair<global_coords, Vector2b> entity::normalize_coords(global_coords coord, Vect auto off_tmp = Vector2i(cur_offset) + new_offset; auto off_new = off_tmp % iTILE_SIZE2; constexpr auto half_tile = iTILE_SIZE2/2; - for (auto i = 0_uz; i < 2; i++) + for (auto i = 0uz; i < 2; i++) { auto sign = sgn(off_new[i]); auto absval = std::abs(off_new[i]); @@ -184,7 +184,7 @@ bool entity::move_to(size_t& i, Vector2i delta, rotation new_r) const_cast<global_coords&>(coord) = coord_; set_bbox_(offset_, bb_offset, bb_size, pass); const_cast<rotation&>(r) = new_r; - //for (auto i = 0_uz; const auto& x : es) fm_debug("%zu %s %f", i++, x->atlas->name().data(), x->ordinal()); + //for (auto i = 0uz; const auto& x : es) fm_debug("%zu %s %f", i++, x->atlas->name().data(), x->ordinal()); //fm_debug("insert (%hd;%hd|%hhd;%hhd) %td -> %zu | %f", coord_.chunk().x, coord_.chunk().y, coord_.local().x, coord_.local().y, pos1, es.size(), e.ordinal()); return false; } diff --git a/src/random.cpp b/src/random.cpp index 6bb70808..442d198e 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -23,7 +23,7 @@ size_t random_engine_impl::operator()() size_t x; uint32_t a[N]; } ret; - for (auto i = 0_uz; i < N; i++) + for (auto i = 0uz; i < N; i++) ret.a[i] = g(); return ret.x; } diff --git a/src/tile-atlas.cpp b/src/tile-atlas.cpp index f7d29864..ed2f6d24 100644 --- a/src/tile-atlas.cpp +++ b/src/tile-atlas.cpp @@ -51,7 +51,7 @@ auto tile_atlas::make_texcoords_array(Vector2ui pixel_size, Vector2ub tile_count { const size_t N = Vector2ui{tile_count}.product(); auto ptr = std::make_unique<std::array<Vector2, 4>[]>(N); - for (auto i = 0_uz; i < N; i++) + for (auto i = 0uz; i < N; i++) ptr[i] = make_texcoords(pixel_size, tile_count, i); return ptr; } |