From 808f3921194187c84a5ed04e27d0d71531dc023f Mon Sep 17 00:00:00 2001 From: zvon Date: Mon, 31 May 2021 14:30:28 +0200 Subject: [PATCH] Mario: silence some warnings --- mario/editor.cpp | 3 ++- sdlpp/sdlpp_mouse.cpp | 13 +++++++++++-- sdlpp/sdlpp_rectrenderer.cpp | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mario/editor.cpp b/mario/editor.cpp index 6f89629..7f3c051 100644 --- a/mario/editor.cpp +++ b/mario/editor.cpp @@ -375,7 +375,7 @@ void selectNextTool() { break; } int addition = 1; - if ( global_vars.tool.index % multiplier == ( multiplier - 1 ) ) + if ( global_vars.tool.index % multiplier == static_cast( multiplier - 1 ) ) addition = multiplier + 1; if ( global_vars.tool.index == max_index ) return; @@ -806,6 +806,7 @@ void populateToolGrid( tool_store.push_back( createMario( global_vars.current_world_type, renderer, 0, 0 ) ); else + // fall through case ToolType::BLOCK: case ToolType::MOD: tool_store.push_back( createTerrainBlock( diff --git a/sdlpp/sdlpp_mouse.cpp b/sdlpp/sdlpp_mouse.cpp index 020dd2d..170b06b 100644 --- a/sdlpp/sdlpp_mouse.cpp +++ b/sdlpp/sdlpp_mouse.cpp @@ -20,10 +20,19 @@ SDLPP::Mouse::getMousePositionDouble( const SDLPP::Renderer &r, ( r.getDoubleDimensions() - Vec2D< double >( 1.0, 1.0 ) ) / 2; switch ( alignment_x ) { case SDLPP::OBJ_CENTER: - ret -= additions; + ret -= { additions.getX(), 0 }; break; case SDLPP::OBJ_END: - ret -= 2 * additions; + ret -= { 2 * additions.getX(), 0 }; + default: + break; + } + switch ( alignment_y ) { + case SDLPP::OBJ_CENTER: + ret -= { 0, additions.getY() }; + break; + case SDLPP::OBJ_END: + ret -= { 0, 2 * additions.getY() }; default: break; } diff --git a/sdlpp/sdlpp_rectrenderer.cpp b/sdlpp/sdlpp_rectrenderer.cpp index f3592e0..ddc16e9 100644 --- a/sdlpp/sdlpp_rectrenderer.cpp +++ b/sdlpp/sdlpp_rectrenderer.cpp @@ -146,9 +146,9 @@ void RectangleRender::updateSizeAndPosition() { rect.h = std::round( ( current.getY() + original_size.getY() ) * dimension ) - rect.y; - if(rect.w < min_size.getX()) + if(static_cast(rect.w) < min_size.getX()) rect.w = min_size.getX(); - if(rect.h < min_size.getY()) + if(static_cast(rect.h) < min_size.getY()) rect.h = min_size.getY(); if ( polygon ) polygon->updateCollision( collisionPushX(), collisionPushY(),