diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-18 01:45:19 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-19 14:32:18 +0100 |
commit | 151e6911a8aa56749edbbf0c15ab04752d96c2f3 (patch) | |
tree | 06fcf3d6551d1945b5717458aa09222c947ede04 | |
parent | e77dc91b5d3e6a5181776a81cee2c3164c7b3cc9 (diff) |
ccc
-rw-r--r-- | draw/anim.cpp | 6 | ||||
-rw-r--r-- | draw/anim.hpp | 2 | ||||
-rw-r--r-- | editor/app.cpp | 4 | ||||
-rw-r--r-- | editor/camera.cpp | 10 | ||||
-rw-r--r-- | editor/draw.cpp | 12 | ||||
-rw-r--r-- | editor/imgui.cpp | 12 | ||||
-rw-r--r-- | editor/inspect-draw.cpp | 6 | ||||
-rw-r--r-- | editor/update.cpp | 6 | ||||
-rw-r--r-- | loader/atlas-loader.inl | 10 | ||||
-rw-r--r-- | main/draw.cpp | 12 | ||||
-rw-r--r-- | serialize/wall-atlas.cpp | 6 | ||||
-rw-r--r-- | shaders/lightmap.cpp | 4 | ||||
-rw-r--r-- | shaders/shader.hpp | 4 | ||||
-rw-r--r-- | src/object.cpp | 14 | ||||
-rw-r--r-- | src/world.cpp | 6 | ||||
-rw-r--r-- | test/math.cpp | 6 | ||||
-rw-r--r-- | test/path-search.cpp | 6 | ||||
-rw-r--r-- | userconfig-sthalik@Windows-Clang.cmake | 1 |
18 files changed, 64 insertions, 63 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp index c6632fa1..5c1f61a7 100644 --- a/draw/anim.cpp +++ b/draw/anim.cpp @@ -33,10 +33,10 @@ std::array<UnsignedShort, 6> anim_mesh::make_index_array() } void anim_mesh::add_clickable(tile_shader& shader, const Vector2i& win_size, - object* s_, const chunk::topo_sort_data& data, + object* sʹ, const chunk::topo_sort_data& data, Array<clickable>& list) { - const auto& s = *s_; + const auto& s = *sʹ; const auto& a = *s.atlas; const auto& g = a.group(s.r); const auto& f = a.frame(s.r, s.frame); @@ -49,7 +49,7 @@ void anim_mesh::add_clickable(tile_shader& shader, const Vector2i& win_size, .src = { f.offset, f.offset + f.size }, .dest = { offset, offset + Vector2i(f.size) }, .bitmask = a.bitmask(), - .e = s_, + .e = sʹ, .depth = s.ordinal() + (float)s.coord.z() * TILE_COUNT, .slope = data.slope, .bb_min = data.bb_min, .bb_max = data.bb_max, diff --git a/draw/anim.hpp b/draw/anim.hpp index a19af1e1..a9fd6011 100644 --- a/draw/anim.hpp +++ b/draw/anim.hpp @@ -30,7 +30,7 @@ struct anim_mesh void draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, const Vector3& pos, float depth); void draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, local_coords xy, Vector2b offset, float dpeth); static void add_clickable(tile_shader& shader, const Vector2i& win_size, - object* s_, const chunk::topo_sort_data& data, + object* s, const chunk::topo_sort_data& data, Array<clickable>& list); private: diff --git a/editor/app.cpp b/editor/app.cpp index 35aa1230..c8c5aa0f 100644 --- a/editor/app.cpp +++ b/editor/app.cpp @@ -32,7 +32,7 @@ shared_ptr_wrapper<critter> app::ensure_player_character(world& w) return w.ensure_player_character(_character_id); } -void app::reset_world(class world&& w_) +void app::reset_world(class world&& wʹ) { if (!M) return; @@ -51,7 +51,7 @@ void app::reset_world(class world&& w_) _render_all_z_levels = true; _timestamp = 0; - auto& w = M->reset_world(move(w_)); + auto& w = M->reset_world(move(wʹ)); w.collect(true); ensure_player_character(w); update_cursor_tile(pixel); diff --git a/editor/camera.cpp b/editor/camera.cpp index 34f02e51..429dbdba 100644 --- a/editor/camera.cpp +++ b/editor/camera.cpp @@ -91,10 +91,10 @@ object_id app::get_object_colliding_with_cursor() for (int16_t x = minx; x <= maxx; x++) { const chunk_coords_ c_pos{x, y, _z_level}; - auto* c_ = world.at(c_pos); - if (!c_) + auto* cʹ = world.at(c_pos); + if (!cʹ) continue; - auto& c = *c_; + auto& c = *cʹ; c.ensure_passability(); const with_shifted_camera_offset o{shader, c_pos, {minx, miny}, {maxx, maxy}}; if (floormat_main::check_chunk_visible(shader.camera_offset(), sz)) @@ -113,8 +113,8 @@ object_id app::get_object_colliding_with_cursor() Vector2 min(rect.m_min[0], rect.m_min[1]), max(rect.m_max[0], rect.m_max[1]); if (t0 >= min && t0 <= max) { - if (auto e_ = world.find_object(x.data); - e_ && Vector2ui(e_->bbox_size).product() != 0) + if (auto eʹ = world.find_object(x.data); + eʹ && Vector2ui(eʹ->bbox_size).product() != 0) { ret = x.data; return false; diff --git a/editor/draw.cpp b/editor/draw.cpp index 40ba0235..d1e18292 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -122,10 +122,10 @@ void app::draw_collision_boxes() for (int16_t x = minx; x <= maxx; x++) { const chunk_coords_ pos{x, y, z}; - auto* c_ = world.at(pos); - if (!c_) + auto* cʹ = world.at(pos); + if (!cʹ) continue; - auto& c = *c_; + auto& c = *cʹ; c.ensure_passability(); const with_shifted_camera_offset o{shader, pos, {minx, miny}, {maxx, maxy}}; if (floormat_main::check_chunk_visible(shader.camera_offset(), sz)) @@ -170,10 +170,10 @@ void app::draw_collision_boxes() for (int16_t x = minx; x <= maxx; x++) { const chunk_coords_ c_pos{x, y, _z_level}; - auto* c_ = world.at(c_pos); - if (!c_) + auto* cʹ = world.at(c_pos); + if (!cʹ) continue; - auto& c = *c_; + auto& c = *cʹ; c.ensure_passability(); const with_shifted_camera_offset o{shader, c_pos, {minx, miny}, {maxx, maxy}}; if (floormat_main::check_chunk_visible(shader.camera_offset(), sz)) diff --git a/editor/imgui.cpp b/editor/imgui.cpp index 62a0850d..45e0268a 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -267,11 +267,11 @@ void app::do_lightmap_test() if (auto* chunk = w.at(c)) { auto offset = Vector2(Vector2i(c.x) - Vector2i(x, y)); - for (const auto& e_ : chunk->objects()) + for (const auto& eʹ : chunk->objects()) { - if (e_->type() == object_type::light) + if (eʹ->type() == object_type::light) { - const auto& li = static_cast<const light&>(*e_); + const auto& li = static_cast<const light&>(*eʹ); if (li.max_distance < 1e-6f) continue; light_s L { @@ -338,16 +338,16 @@ void app::do_popup_menu() { const auto [id, target] = _popup_target; auto& w = M->world(); - auto e_ = w.find_object(id); + auto eʹ = w.find_object(id); - if (target == popup_target_type::none || !e_) + if (target == popup_target_type::none || !eʹ) { _popup_target = {}; _pending_popup = {}; return; } - auto& e = *e_; + auto& e = *eʹ; auto b0 = push_id(SCENERY_POPUP_NAME); //if (_popup_target.target != popup_target_type::scenery) {...} diff --git a/editor/inspect-draw.cpp b/editor/inspect-draw.cpp index 7b2e5009..128e619f 100644 --- a/editor/inspect-draw.cpp +++ b/editor/inspect-draw.cpp @@ -26,13 +26,13 @@ void app::draw_inspector() for (auto i = (int)(inspectors.size()-1); i >= 0; i--) { auto [id, target] = inspectors[i]; - auto e_ = w.find_object(id); - if (!e_) + auto eʹ = w.find_object(id); + if (!eʹ) { erase_inspector((unsigned)i); continue; } - auto& e = *e_; + auto& e = *eʹ; char buf[256], buf2[32], buf3[128]; ImGui::SetNextWindowSize({375*dpi[0], 0}); diff --git a/editor/update.cpp b/editor/update.cpp index 6e5269cc..6987b411 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -232,10 +232,10 @@ void app::update_world(Ns dt) for (int16_t y = miny; y <= maxy; y++) for (int16_t x = minx; x <= maxx; x++) { - auto* c_ = world.at({x, y, z}); - if (!c_) + auto* cʹ = world.at({x, y, z}); + if (!cʹ) continue; - auto& c = *c_; + auto& c = *cʹ; const auto& es = c.objects(); const auto size = es.size(); for (auto i = (int)(size-1); i >= 0; i--) diff --git a/loader/atlas-loader.inl b/loader/atlas-loader.inl index 8b5f9595..55691597 100644 --- a/loader/atlas-loader.inl +++ b/loader/atlas-loader.inl @@ -131,13 +131,13 @@ auto atlas_loader<ATLAS, TRAITS>::get_atlas(StringView name, const loader_policy } } } - else if (Optional<Cell> c_{t.make_cell(name)}) + else if (Optional<Cell> cʹ{t.make_cell(name)}) { - fm_assert(t.name_of(*c_)); - fm_assert(!t.atlas_of(*c_)); - fm_assert(t.name_of(*c_) == name); + fm_assert(t.name_of(*cʹ)); + fm_assert(!t.atlas_of(*cʹ)); + fm_assert(t.name_of(*cʹ) == name); const size_t index{s.cell_array.size()}; - arrayAppend(s.cell_array, move(*c_)); + arrayAppend(s.cell_array, move(*cʹ)); Cell& c{s.cell_array.back()}; String& name_{t.name_of(c)}; if (name_.isSmall()) name_ = String{AllocatedInit, name_}; diff --git a/main/draw.cpp b/main/draw.cpp index b8063824..5831a0b7 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -97,10 +97,10 @@ void main_impl::draw_world() noexcept for (int16_t x = maxx; x >= minx; x--) { const chunk_coords_ ch{x, y, z}; - auto* c_ = _world.at(ch); - if (!c_) + auto* cʹ = _world.at(ch); + if (!cʹ) continue; - auto& c = *c_; + auto& c = *cʹ; bind(); const with_shifted_camera_offset o{_shader, ch, {minx, miny}, {maxx, maxy}}; @@ -124,10 +124,10 @@ void main_impl::draw_world() noexcept _shader.set_tint({1, 1, 1, 1}); const chunk_coords_ pos{x, y, z}; - auto* c_ = _world.at(pos); - if (!c_) + auto* cʹ = _world.at(pos); + if (!cʹ) continue; - auto& c = *c_; + auto& c = *cʹ; const with_shifted_camera_offset o{_shader, pos, {minx, miny}, {maxx, maxy}}; if (check_chunk_visible(_shader.camera_offset(), sz)) _anim_mesh.draw(_shader, sz, c, _clickable_scenery, _do_render_vobjs); diff --git a/serialize/wall-atlas.cpp b/serialize/wall-atlas.cpp index 3e120bb5..8e9ba21b 100644 --- a/serialize/wall-atlas.cpp +++ b/serialize/wall-atlas.cpp @@ -228,9 +228,9 @@ Group read_group_metadata(const json& jgroup) Direction read_direction_metadata(const json& jroot, Direction_ dir) { - const auto s_ = direction_index_to_name((size_t)dir); - fm_assert(s_.size() == 1); - std::string_view s = {s_.data(), s_.size()}; + const auto sʹ = direction_index_to_name((size_t)dir); + fm_assert(sʹ.size() == 1); + std::string_view s = {sʹ.data(), sʹ.size()}; fm_assert(s.size() == 1); if (!jroot.contains(s)) return {}; diff --git a/shaders/lightmap.cpp b/shaders/lightmap.cpp index 14bb27e2..bca81c6a 100644 --- a/shaders/lightmap.cpp +++ b/shaders/lightmap.cpp @@ -397,9 +397,9 @@ void lightmap_shader::add_geometry(Vector2 neighbor_offset, chunk& c) void lightmap_shader::add_objects(Vector2 neighbor_offset, chunk& c) { - for (const auto& e_ : c.objects()) + for (const auto& eʹ : c.objects()) { - const auto& e = *e_; + const auto& e = *eʹ; if (e.is_virtual()) continue; if (e.pass == pass_mode::pass || e.pass == pass_mode::see_through) diff --git a/shaders/shader.hpp b/shaders/shader.hpp index 41f876e1..864e20b7 100644 --- a/shaders/shader.hpp +++ b/shaders/shader.hpp @@ -96,8 +96,8 @@ constexpr Math::Vector2<T> tile_shader::unproject(const Math::Vector2<T>& px) { static_assert(std::is_floating_point_v<T>); const auto X = px[0], Y = px[1]; - const auto Y_ = Y / T(foreshortening_factor); - return { X + Y_, Y_ - X }; + const auto Yʹ = Y / T(foreshortening_factor); + return { X + Yʹ, Yʹ - X }; } } // namespace floormat diff --git a/src/object.cpp b/src/object.cpp index 72d922fc..7f0b9afb 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -197,15 +197,15 @@ bool object::can_move_to(Vector2i delta, global_coords coord2, Vector2b offset, return false; auto& w = *c->_world; - auto& c_ = coord_.chunk() == coord.chunk() ? *c : w[coord_.chunk3()]; + auto& cʹ = coord_.chunk() == coord.chunk() ? *c : w[coord_.chunk3()]; const auto center = Vector2(coord_.local())*TILE_SIZE2 + Vector2(offset_) + Vector2(bbox_offset), half_bbox = Vector2(bbox_size)*.5f, min = center - half_bbox, max = min + Vector2(bbox_size); - if (!do_search<false>(&c_, coord_, id, min, max)) + if (!do_search<false>(&cʹ, coord_, id, min, max)) return false; for (const auto& off : world::neighbor_offsets) - if (!do_search(&c_, coord_, id, min, max, off)) + if (!do_search(&cʹ, coord_, id, min, max, off)) return false; return true; } @@ -232,8 +232,8 @@ void object::teleport_to(size_t& i, global_coords coord_, Vector2b offset_, rota } fm_assert(i < c->_objects.size()); - const auto e_ = c->_objects[i]; - fm_assert(&*e_ == this); + const auto eʹ = c->_objects[i]; + fm_assert(&*eʹ == this); if (coord_ == coord && offset_ == offset) return; @@ -268,8 +268,8 @@ void object::teleport_to(size_t& i, global_coords coord_, Vector2b offset_, rota set_bbox_(offset_, bb_offset, bb_size, pass); const_cast<rotation&>(r) = new_r; const_cast<class chunk*&>(c) = &c2; - i = (size_t)std::distance(es.cbegin(), std::lower_bound(es.cbegin(), es.cend(), e_, object_id_lessp)); - arrayInsert(es, i, move(e_)); + i = (size_t)std::distance(es.cbegin(), std::lower_bound(es.cbegin(), es.cend(), eʹ, object_id_lessp)); + arrayInsert(es, i, move(eʹ)); } } diff --git a/src/world.cpp b/src/world.cpp index adbcf540..7a4fc079 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -231,16 +231,16 @@ shared_ptr_wrapper<critter> world::ensure_player_character(object_id& id_, critt for (const auto& [coord, c] : chunks()) // todo use world::_objects { - for (const auto& e_ : c.objects()) + for (const auto& eʹ : c.objects()) { - const auto& e = *e_; + const auto& e = *eʹ; if (e.type() == object_type::critter) { const auto& C = static_cast<const critter&>(e); if (C.playable) { id = std::min(id, C.id); - ret.ptr = std::static_pointer_cast<critter>(e_); + ret.ptr = std::static_pointer_cast<critter>(eʹ); } } } diff --git a/test/math.cpp b/test/math.cpp index 6535e998..9befad18 100644 --- a/test/math.cpp +++ b/test/math.cpp @@ -20,9 +20,9 @@ bool test_sqrt() constexpr auto eps = F(1e-11); constexpr auto test = [](double x) { - auto x_ = (F)x; - auto y1 = Math::sqrt(x_); - auto y2 = std::sqrt(x_); + auto xʹ = (F)x; + auto y1 = Math::sqrt(xʹ); + auto y2 = std::sqrt(xʹ); return Math::abs(y1 - y2) < eps; }; diff --git a/test/path-search.cpp b/test/path-search.cpp index 069960c1..e3c11e28 100644 --- a/test/path-search.cpp +++ b/test/path-search.cpp @@ -20,10 +20,10 @@ constexpr bbox<int> get_value(Vector2i sz, Vector2ui div, rotation r) { const int offset_W = iTILE_SIZE2.x()/(int)div.x(), offset_N = iTILE_SIZE2.y()/(int)div.y(); - const auto r_ = (uint8_t)r; - CORRADE_ASSUME(r_ <= (uint8_t)rotation_COUNT); + const auto rʹ = (uint8_t)r; + CORRADE_ASSUME(rʹ <= (uint8_t)rotation_COUNT); - switch (r_) + switch (rʹ) { case (uint8_t)rotation::N: { auto min_N = Vector2i(-sz.x()/2, -offset_N - sz.y()/2 ); diff --git a/userconfig-sthalik@Windows-Clang.cmake b/userconfig-sthalik@Windows-Clang.cmake index 557905ad..33eff299 100644 --- a/userconfig-sthalik@Windows-Clang.cmake +++ b/userconfig-sthalik@Windows-Clang.cmake @@ -122,6 +122,7 @@ function(fm-userconfig-src) -Wno-unsafe-buffer-usage -Wno-bitwise-op-parentheses -Wno-weak-vtables + -Wno-c99-compat ) add_compile_options( -Werror |