Minor improvements

This commit is contained in:
Lynix
2024-01-29 18:34:46 +01:00
parent 0191256493
commit 2b88f50c21
19 changed files with 34 additions and 41 deletions

View File

@@ -120,7 +120,7 @@ namespace Nz
inline void Tilemap::EnableTile(const Vector2ui& tilePos, const Rectf& coords, const Color& color, std::size_t materialIndex)
{
NazaraAssert(tilePos.x < m_mapSize.x&& tilePos.y < m_mapSize.y, "Tile position is out of bounds");
NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds");
NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size());
std::size_t tileIndex = tilePos.y * m_mapSize.x + tilePos.x;
Tile& tile = m_tiles[tilePos.y * m_mapSize.x + tilePos.x];
@@ -168,7 +168,7 @@ namespace Nz
*/
inline void Tilemap::EnableTile(const Vector2ui& tilePos, const Rectui& rect, const Color& color, std::size_t materialIndex)
{
NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds");
NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size());
Vector2ui textureSize(GetTextureSize(materialIndex));
float invWidth = 1.f / textureSize.x;
@@ -194,7 +194,7 @@ namespace Nz
*/
inline void Tilemap::EnableTiles(const Rectf& coords, const Color& color, std::size_t materialIndex)
{
NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds");
NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size());
for (Layer& layer : m_layers)
layer.enabledTiles.Reset();
@@ -231,7 +231,7 @@ namespace Nz
*/
inline void Tilemap::EnableTiles(const Rectui& rect, const Color& color, std::size_t materialIndex)
{
NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds");
NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size());
Vector2ui textureSize(GetTextureSize(materialIndex));
float invWidth = 1.f / textureSize.x;
@@ -257,7 +257,7 @@ namespace Nz
inline void Tilemap::EnableTiles(const Vector2ui* tilesPos, std::size_t tileCount, const Rectf& coords, const Color& color, std::size_t materialIndex)
{
NazaraAssert(tilesPos || tileCount == 0, "Invalid tile position array with a non-zero tileCount");
NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds");
NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size());
for (std::size_t i = 0; i < tileCount; ++i)
{
@@ -316,7 +316,7 @@ namespace Nz
*/
inline void Tilemap::EnableTiles(const Vector2ui* tilesPos, std::size_t tileCount, const Rectui& rect, const Color& color, std::size_t materialIndex)
{
NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds");
NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size());
Vector2ui textureSize(GetTextureSize(materialIndex));
float invWidth = 1.f / textureSize.x;