From 452b553350196330322f09e1f63a2b6088ad1630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Sun, 21 Jan 2024 12:45:58 +0100 Subject: [PATCH] Fix various warnings that had piled up --- src/lua/LuaScriptInterface.cpp | 2 +- src/simulation/elements/ETRD.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index 70d0613d9..3b66212f8 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -1447,7 +1447,7 @@ static int LuaBlockMap(lua_State *L, ItemType minValue, ItemType maxValue, Acces template::ItemType> static int LuaBlockMap(lua_State *L, Accessor accessor) { - return LuaBlockMapImpl(L, 0, 0, accessor); + return LuaBlockMapImpl(L, ItemType(0), ItemType(0), accessor); } static int sim_velocityX(lua_State *L) diff --git a/src/simulation/elements/ETRD.cpp b/src/simulation/elements/ETRD.cpp index 6ff097fe6..888069817 100644 --- a/src/simulation/elements/ETRD.cpp +++ b/src/simulation/elements/ETRD.cpp @@ -85,7 +85,7 @@ static void initDeltaPos() { ui::Point d(rx, ry); if (std::abs(d.X) + std::abs(d.Y) <= maxLength) - deltaPos.push_back(ETRD_deltaWithLength(d, std::hypot(d.X, d.Y))); + deltaPos.push_back(ETRD_deltaWithLength(d, int(std::hypot(d.X, d.Y)))); } std::stable_sort(deltaPos.begin(), deltaPos.end(), [](const ETRD_deltaWithLength &a, const ETRD_deltaWithLength &b) { return a.length < b.length; @@ -103,7 +103,7 @@ int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId) if (parts[targetId].tmp2 && parts[targetId].tmp > parts[targetId].tmp2) // Invalid range if max is set return -1; - const int maxDistance = std::hypot(XRES, YRES); + const int maxDistance = int(std::hypot(XRES, YRES)); int foundDistance = parts[targetId].tmp2 ? std::min(parts[targetId].tmp2, maxDistance) : maxDistance; // tmp2 sets max distance int foundI = -1; ui::Point targetPos = ui::Point(int(parts[targetId].x), int(parts[targetId].y)); @@ -150,7 +150,7 @@ int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId) if (parts[i].type == PT_ETRD && !parts[i].life) { ui::Point checkPos = ui::Point(int(parts[i].x)-targetPos.X, int(parts[i].y)-targetPos.Y); - int checkDistance = std::hypot(checkPos.X, checkPos.Y); + int checkDistance = int(std::hypot(checkPos.X, checkPos.Y)); if (checkDistance < foundDistance && checkDistance > parts[targetId].tmp && i != targetId) // tmp sets min distance { foundDistance = checkDistance; @@ -170,7 +170,7 @@ int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId) { countLife0++; ui::Point checkPos = ui::Point(int(parts[i].x)-targetPos.X, int(parts[i].y)-targetPos.Y); - int checkDistance = std::hypot(checkPos.X, checkPos.Y); + int checkDistance = int(std::hypot(checkPos.X, checkPos.Y)); if (checkDistance < foundDistance && checkDistance > parts[targetId].tmp && i != targetId) // tmp sets min distance { foundDistance = checkDistance;