1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Change VoxelArea volume to be u32

This commit is contained in:
sfan5 2024-12-06 21:17:59 +01:00
parent 67126cbd1b
commit 4f800dd2b4
6 changed files with 20 additions and 19 deletions

View file

@ -119,10 +119,10 @@ public:
return !m_cache_extent.X || !m_cache_extent.Y || !m_cache_extent.Z;
}
s32 getVolume() const
u32 getVolume() const
{
// FIXME: possible integer overflow here
return m_cache_extent.X * m_cache_extent.Y * m_cache_extent.Z;
return (u32)m_cache_extent.X * (u32)m_cache_extent.Y * (u32)m_cache_extent.Z;
}
bool contains(const VoxelArea &a) const
@ -148,8 +148,9 @@ public:
}
bool contains(s32 i) const
{
return (i >= 0 && i < getVolume());
return i >= 0 && static_cast<u32>(i) < getVolume();
}
bool operator==(const VoxelArea &other) const
{
return (MinEdge == other.MinEdge