Fix various warnings that had piled up

This commit is contained in:
Tamás Bálint Misius 2024-01-21 12:45:58 +01:00
parent 8e6faddd2f
commit 452b553350
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 5 additions and 5 deletions

View File

@ -1447,7 +1447,7 @@ static int LuaBlockMap(lua_State *L, ItemType minValue, ItemType maxValue, Acces
template<class Accessor, class ItemType = typename LuaBlockMapHelper<Accessor>::ItemType>
static int LuaBlockMap(lua_State *L, Accessor accessor)
{
return LuaBlockMapImpl<false>(L, 0, 0, accessor);
return LuaBlockMapImpl<false>(L, ItemType(0), ItemType(0), accessor);
}
static int sim_velocityX(lua_State *L)

View File

@ -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;