summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-02 11:38:37 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-02 11:38:37 +0100
commitb98f3159744b800e664d2aae61aa6faf9453f057 (patch)
treecc1a967de80af2c837bc8a47ea7857104985b9f7 /editor
parentf8663e13d49e50412c2faccf0d6c46bc3a90a9f1 (diff)
c
Diffstat (limited to 'editor')
-rw-r--r--editor/inspect-draw.cpp6
-rw-r--r--editor/tests/raycast-test.cpp2
-rw-r--r--editor/update.cpp4
-rw-r--r--editor/vobj-editor.cpp4
4 files changed, 8 insertions, 8 deletions
diff --git a/editor/inspect-draw.cpp b/editor/inspect-draw.cpp
index 34c096ea..e47ac692 100644
--- a/editor/inspect-draw.cpp
+++ b/editor/inspect-draw.cpp
@@ -20,13 +20,13 @@ void app::draw_inspector()
const auto dpi = M->dpi_scale();
auto& w = M->world();
- for (auto i = inspectors.size()-1; i != -1uz; i--)
+ for (auto i = (int)(inspectors.size()-1); i >= 0; i--)
{
auto [id, target] = inspectors[i];
auto e_ = w.find_object(id);
if (!e_)
{
- erase_inspector(i);
+ erase_inspector((unsigned)i);
continue;
}
auto& e = *e_;
@@ -53,7 +53,7 @@ auto z = e.coord.z();
(void)ret;
}
if (!is_open)
- erase_inspector(i);
+ erase_inspector((unsigned)i);
}
}
diff --git a/editor/tests/raycast-test.cpp b/editor/tests/raycast-test.cpp
index 24f0fde2..ec0dc5ec 100644
--- a/editor/tests/raycast-test.cpp
+++ b/editor/tests/raycast-test.cpp
@@ -225,7 +225,7 @@ struct raycast_test : base_test
auto size = Vector2ui(Math::round(Math::abs(v)));
const auto half = Vector2i(v*.5);
- auto nsteps = (uint32_t)Math::ceil(Math::abs(vec[long_axis] / step));
+ auto nsteps = (uint32_t)Math::max(1., Math::ceil(Math::abs(vec[long_axis] / step)));
result.path.clear();
result.path.reserve(nsteps);
diff --git a/editor/update.cpp b/editor/update.cpp
index 62f0e5d3..6e6a18e7 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -209,8 +209,8 @@ void app::update_world(float dt)
auto& c = *c_;
const auto& es = c.objects();
const auto size = es.size();
- for (auto i = size-1; i != (size_t)-1; i--)
- es[i]->update(i, dt);
+ for (auto i = (int)(size-1); i >= 0; i--)
+ es[i]->update((unsigned)i, dt);
}
}
diff --git a/editor/vobj-editor.cpp b/editor/vobj-editor.cpp
index 61eb0de7..ea9b8659 100644
--- a/editor/vobj-editor.cpp
+++ b/editor/vobj-editor.cpp
@@ -47,11 +47,11 @@ void vobj_editor::place_tile(world& w, global_coords pos, const vobj_* x, struct
const auto& es = c.objects();
start: while (auto id = a.get_object_colliding_with_cursor())
{
- for (auto i = es.size()-1; i != (size_t)-1; i--)
+ for (auto i = (int)(es.size()-1); i >= 0; i--)
{
if (es[i]->id == id)
{
- c.remove_object(i);
+ c.remove_object((unsigned)i);
goto start;
}
}