mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 11:19:51 +02:00
Fix various warnings that had piled up
This commit is contained in:
@@ -1447,7 +1447,7 @@ static int LuaBlockMap(lua_State *L, ItemType minValue, ItemType maxValue, Acces
|
|||||||
template<class Accessor, class ItemType = typename LuaBlockMapHelper<Accessor>::ItemType>
|
template<class Accessor, class ItemType = typename LuaBlockMapHelper<Accessor>::ItemType>
|
||||||
static int LuaBlockMap(lua_State *L, Accessor accessor)
|
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)
|
static int sim_velocityX(lua_State *L)
|
||||||
|
@@ -85,7 +85,7 @@ static void initDeltaPos()
|
|||||||
{
|
{
|
||||||
ui::Point d(rx, ry);
|
ui::Point d(rx, ry);
|
||||||
if (std::abs(d.X) + std::abs(d.Y) <= maxLength)
|
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) {
|
std::stable_sort(deltaPos.begin(), deltaPos.end(), [](const ETRD_deltaWithLength &a, const ETRD_deltaWithLength &b) {
|
||||||
return a.length < b.length;
|
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
|
if (parts[targetId].tmp2 && parts[targetId].tmp > parts[targetId].tmp2) // Invalid range if max is set
|
||||||
return -1;
|
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 foundDistance = parts[targetId].tmp2 ? std::min(parts[targetId].tmp2, maxDistance) : maxDistance; // tmp2 sets max distance
|
||||||
int foundI = -1;
|
int foundI = -1;
|
||||||
ui::Point targetPos = ui::Point(int(parts[targetId].x), int(parts[targetId].y));
|
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)
|
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);
|
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
|
if (checkDistance < foundDistance && checkDistance > parts[targetId].tmp && i != targetId) // tmp sets min distance
|
||||||
{
|
{
|
||||||
foundDistance = checkDistance;
|
foundDistance = checkDistance;
|
||||||
@@ -170,7 +170,7 @@ int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId)
|
|||||||
{
|
{
|
||||||
countLife0++;
|
countLife0++;
|
||||||
ui::Point checkPos = ui::Point(int(parts[i].x)-targetPos.X, int(parts[i].y)-targetPos.Y);
|
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
|
if (checkDistance < foundDistance && checkDistance > parts[targetId].tmp && i != targetId) // tmp sets min distance
|
||||||
{
|
{
|
||||||
foundDistance = checkDistance;
|
foundDistance = checkDistance;
|
||||||
|
Reference in New Issue
Block a user