Various little fixes (#118)

* Add missing override qualifier

* Mostly shadowing, virtual destructor and other little things
This commit is contained in:
Gawaboumga
2017-02-19 23:15:13 +01:00
committed by Jérôme Leclercq
parent ee9712fdcd
commit c2e4ccaf72
38 changed files with 94 additions and 92 deletions

View File

@@ -312,9 +312,9 @@ namespace Nz
while (!remainingRects.empty())
{
// Stores the penalty score of the best rectangle placement - bigger=worse, smaller=better.
bool bestFlipped;
std::size_t bestFreeRect;
std::size_t bestRect;
bool bestFlipped = false;
std::size_t bestFreeRect = m_freeRectangles.size();
std::size_t bestRect = std::numeric_limits<int>::min();
int bestScore = std::numeric_limits<int>::max();
for (std::size_t i = 0; i < m_freeRectangles.size(); ++i)

View File

@@ -413,9 +413,9 @@ namespace Nz
while (ptr != &s_list)
{
if (ptr->file)
std::fprintf(log, "-0x%p -> %zu bytes allocated at %s:%u\n", reinterpret_cast<UInt8*>(ptr) + sizeof(Block), ptr->size, ptr->file, ptr->line);
std::fprintf(log, "-0x%s -> %zu bytes allocated at %s:%u\n", reinterpret_cast<UInt8*>(ptr) + sizeof(Block), ptr->size, ptr->file, ptr->line);
else
std::fprintf(log, "-0x%p -> %zu bytes allocated at unknown position\n", reinterpret_cast<UInt8*>(ptr) + sizeof(Block), ptr->size);
std::fprintf(log, "-0x%s -> %zu bytes allocated at unknown position\n", reinterpret_cast<UInt8*>(ptr) + sizeof(Block), ptr->size);
void* pointer = ptr;
ptr = ptr->next;

View File

@@ -39,9 +39,9 @@ namespace Nz
*/
ParticleGroup::ParticleGroup(unsigned int maxParticleCount, ParticleDeclarationConstRef declaration) :
m_declaration(std::move(declaration)),
m_maxParticleCount(maxParticleCount),
m_particleCount(0),
m_declaration(std::move(declaration)),
m_processing(false)
{
// In case of error, the constructor can only throw an exception
@@ -60,13 +60,13 @@ namespace Nz
ParticleGroup::ParticleGroup(const ParticleGroup& system) :
Renderable(system),
m_maxParticleCount(system.m_maxParticleCount),
m_particleCount(system.m_particleCount),
m_particleSize(system.m_particleSize),
m_controllers(system.m_controllers),
m_generators(system.m_generators),
m_declaration(system.m_declaration),
m_renderer(system.m_renderer),
m_maxParticleCount(system.m_maxParticleCount),
m_particleCount(system.m_particleCount),
m_particleSize(system.m_particleSize),
m_processing(false)
{
ErrorFlags flags(ErrorFlag_ThrowException, true);

View File

@@ -129,7 +129,7 @@ namespace Nz
if (s_useAnisotropicFilter)
{
for (const std::pair<UInt32, GLuint>& pair : s_samplers)
for (const std::pair<const UInt32, GLuint>& pair : s_samplers)
{
if (((pair.first >> 5) & 0xFF) == 0)
glSamplerParameterf(pair.second, GL_TEXTURE_MAX_ANISOTROPY_EXT, static_cast<float>(anisotropyLevel));
@@ -149,7 +149,7 @@ namespace Nz
s_defaultFilterMode = filterMode;
for (const std::pair<UInt32, GLuint>& pair : s_samplers)
for (const std::pair<const UInt32, GLuint>& pair : s_samplers)
{
if (((pair.first >> 1) & 0x3) == SamplerFilter_Default)
{
@@ -204,7 +204,7 @@ namespace Nz
s_defaultWrapMode = wrapMode;
GLenum wrapEnum = OpenGL::SamplerWrapMode[wrapMode];
for (const std::pair<UInt32, GLuint>& pair : s_samplers)
for (const std::pair<const UInt32, GLuint>& pair : s_samplers)
{
if (((pair.first >> 3) & 0x3) == SamplerWrap_Default)
{
@@ -380,7 +380,7 @@ namespace Nz
if (!s_samplers.empty())
{
Context::EnsureContext();
for (const std::pair<UInt32, GLuint>& pair : s_samplers)
for (const std::pair<const UInt32, GLuint>& pair : s_samplers)
OpenGL::DeleteSampler(pair.second);
s_samplers.clear();

View File

@@ -369,7 +369,7 @@ namespace Nz
if (!m_glyphs.empty())
{
Glyph& lastGlyph = m_glyphs.back();
m_lines.back().bounds.ExtendTo(glyph.bounds);
m_lines.back().bounds.ExtendTo(lastGlyph.bounds);
}
// Reset cursor