From e46e898f6e437c093c1cbd2dc516c2bd0e6d8c37 Mon Sep 17 00:00:00 2001 From: Andrej Manduch Date: Wed, 23 Oct 2013 11:44:09 +0200 Subject: [PATCH 1/2] fixed some warnings from compiler --- smc/src/core/game_core.cpp | 2 -- smc/src/core/i18n.cpp | 3 --- smc/src/gui/menu_data.cpp | 2 -- smc/src/level/level_player.cpp | 2 +- smc/src/overworld/world_layer.cpp | 3 ++- smc/src/video/video.cpp | 10 +++++----- 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/smc/src/core/game_core.cpp b/smc/src/core/game_core.cpp index 5d5201c26..749f78293 100644 --- a/smc/src/core/game_core.cpp +++ b/smc/src/core/game_core.cpp @@ -78,8 +78,6 @@ void Handle_Game_Events( void ) while( Game_Action != GA_NONE ) { // get current data - const GameMode current_game_mode = Game_Mode; - const GameModeType current_game_mode_type = Game_Mode_Type; const GameAction current_game_action = Game_Action; const CEGUI::XMLAttributes current_game_action_data_start = Game_Action_Data_Start; const CEGUI::XMLAttributes current_game_action_data_middle = Game_Action_Data_Middle; diff --git a/smc/src/core/i18n.cpp b/smc/src/core/i18n.cpp index ba70d6d82..f9af6b6b1 100644 --- a/smc/src/core/i18n.cpp +++ b/smc/src/core/i18n.cpp @@ -43,9 +43,6 @@ void I18N_Init( void ) printf( "Warning: bindtextdomain failed for %s\n", DATA_DIR "/" GAME_TRANSLATION_DIR ); } - const char *textdomain_codeset = bind_textdomain_codeset( CAPTION, "UTF-8" ); - const char *textdomain_default = textdomain( CAPTION ); - debug_print( "Translation support with gettext set to:\n\tDirectory %s\n\tCodeset: %s\n\tText domain: %s\n", textdomain_directory, textdomain_codeset, textdomain_default ); } diff --git a/smc/src/gui/menu_data.cpp b/smc/src/gui/menu_data.cpp index 1d9059462..034f2aa7f 100644 --- a/smc/src/gui/menu_data.cpp +++ b/smc/src/gui/menu_data.cpp @@ -1196,8 +1196,6 @@ void cMenu_Options :: Init( void ) m_vid_geometry_detail = pVideo->m_geometry_quality; m_vid_texture_detail = pVideo->m_texture_quality; - cMenu_Item *temp_item = NULL; - // options image cHudSprite *hud_sprite = new cHudSprite( pMenuCore->m_handler->m_level->m_sprite_manager ); hud_sprite->Set_Image( pVideo->Get_Surface( "menu/options.png" ) ); diff --git a/smc/src/level/level_player.cpp b/smc/src/level/level_player.cpp index c4393c19a..3af72589e 100644 --- a/smc/src/level/level_player.cpp +++ b/smc/src/level/level_player.cpp @@ -44,7 +44,7 @@ namespace SMC { // Milliseconds to enable power jump when ducking -const int power_jump_delta = 1000; +const unsigned int power_jump_delta = 1000; const float cLevel_Player::m_default_pos_x = 200.0f; const float cLevel_Player::m_default_pos_y = -300.0f; diff --git a/smc/src/overworld/world_layer.cpp b/smc/src/overworld/world_layer.cpp index 8a79757de..50f781ab5 100644 --- a/smc/src/overworld/world_layer.cpp +++ b/smc/src/overworld/world_layer.cpp @@ -457,7 +457,8 @@ cLine_collision cLayer :: Get_Nearest( float x, float y, ObjectDirection dir /* cLayer_Line_Point_Start *layer_line = (*itr); // line is not from waypoint - if( only_origin_id >= 0 && only_origin_id != layer_line->m_origin ) + if( only_origin_id >= 0) + if((unsigned)only_origin_id != layer_line->m_origin ) { continue; } diff --git a/smc/src/video/video.cpp b/smc/src/video/video.cpp index a6d250e6e..60b6f571e 100644 --- a/smc/src/video/video.cpp +++ b/smc/src/video/video.cpp @@ -1279,8 +1279,8 @@ cGL_Surface *cVideo :: Load_GL_Surface( std::string filename, bool use_settings SDL_Surface *cVideo :: Convert_To_Final_Software_Image( SDL_Surface *surface ) const { // get power of two size - const unsigned int width = Get_Power_of_2( surface->w ); - const unsigned int height = Get_Power_of_2( surface->h ); + const int width = Get_Power_of_2( surface->w ); + const int height = Get_Power_of_2( surface->h ); // if it needs to be changed if( width != surface->w || height != surface->h || surface->format->BitsPerPixel != 32 ) @@ -1306,7 +1306,7 @@ SDL_Surface *cVideo :: Convert_To_Final_Software_Image( SDL_Surface *surface ) c return surface; } -cGL_Surface *cVideo :: Create_Texture( SDL_Surface *surface, bool mipmap /* = 0 */, unsigned int force_width /* = 0 */, unsigned int force_height /* = 0 */ ) const +cGL_Surface *cVideo :: Create_Texture( SDL_Surface *surface, bool mipmap /* = 0 */,unsigned int force_width /* = 0 */, unsigned int force_height /* = 0 */ ) const { if( !surface ) { @@ -1343,14 +1343,14 @@ cGL_Surface *cVideo :: Create_Texture( SDL_Surface *surface, bool mipmap /* = 0 int height = surface->h; // forced size is set - if( force_width > 0 && force_height > 0 ) + if( force_width != 0 && force_height != 0 ) { // get power of two size force_width = Get_Power_of_2( force_width ); force_height = Get_Power_of_2( force_height ); // apply forced size - if( force_width != width || force_height != height ) + if( force_width != (unsigned)width || force_height != (unsigned)height ) { width = force_width; height = force_height; From 7d3c400fe62bfaf32260ad6cf7efef7deb37f04f Mon Sep 17 00:00:00 2001 From: Andrej Manduch Date: Wed, 23 Oct 2013 11:44:09 +0200 Subject: [PATCH 2/2] fixed some warnings from compiler --- smc/src/audio/audio.cpp | 4 ++-- smc/src/core/game_core.cpp | 2 -- smc/src/core/i18n.cpp | 2 ++ smc/src/gui/menu_data.cpp | 2 -- smc/src/level/level_player.cpp | 2 +- smc/src/overworld/world_layer.cpp | 3 ++- smc/src/video/video.cpp | 10 +++++----- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/smc/src/audio/audio.cpp b/smc/src/audio/audio.cpp index efa8eeacd..18f52cfeb 100644 --- a/smc/src/audio/audio.cpp +++ b/smc/src/audio/audio.cpp @@ -167,7 +167,7 @@ bool cAudio :: Init( void ) bool music = pPreferences->m_audio_music; // if no change - if( numtimesopened && m_music_enabled == music && m_sound_enabled == sound && dev_frequency == pPreferences->m_audio_hz ) + if( numtimesopened && m_music_enabled == music && m_sound_enabled == sound && (unsigned)dev_frequency == pPreferences->m_audio_hz ) { return 1; } @@ -211,7 +211,7 @@ bool cAudio :: Init( void ) else { // different frequency - if( pPreferences->m_audio_hz != dev_frequency ) + if( pPreferences->m_audio_hz != (unsigned)dev_frequency ) { printf( "Warning : different frequency got %d but requested %d\n", dev_frequency, pPreferences->m_audio_hz ); } diff --git a/smc/src/core/game_core.cpp b/smc/src/core/game_core.cpp index 5d5201c26..749f78293 100644 --- a/smc/src/core/game_core.cpp +++ b/smc/src/core/game_core.cpp @@ -78,8 +78,6 @@ void Handle_Game_Events( void ) while( Game_Action != GA_NONE ) { // get current data - const GameMode current_game_mode = Game_Mode; - const GameModeType current_game_mode_type = Game_Mode_Type; const GameAction current_game_action = Game_Action; const CEGUI::XMLAttributes current_game_action_data_start = Game_Action_Data_Start; const CEGUI::XMLAttributes current_game_action_data_middle = Game_Action_Data_Middle; diff --git a/smc/src/core/i18n.cpp b/smc/src/core/i18n.cpp index ba70d6d82..bc8c501f5 100644 --- a/smc/src/core/i18n.cpp +++ b/smc/src/core/i18n.cpp @@ -43,11 +43,13 @@ void I18N_Init( void ) printf( "Warning: bindtextdomain failed for %s\n", DATA_DIR "/" GAME_TRANSLATION_DIR ); } +# ifdef _DEBUG const char *textdomain_codeset = bind_textdomain_codeset( CAPTION, "UTF-8" ); const char *textdomain_default = textdomain( CAPTION ); debug_print( "Translation support with gettext set to:\n\tDirectory %s\n\tCodeset: %s\n\tText domain: %s\n", textdomain_directory, textdomain_codeset, textdomain_default ); +# endif } #ifdef _WIN32 diff --git a/smc/src/gui/menu_data.cpp b/smc/src/gui/menu_data.cpp index 1d9059462..034f2aa7f 100644 --- a/smc/src/gui/menu_data.cpp +++ b/smc/src/gui/menu_data.cpp @@ -1196,8 +1196,6 @@ void cMenu_Options :: Init( void ) m_vid_geometry_detail = pVideo->m_geometry_quality; m_vid_texture_detail = pVideo->m_texture_quality; - cMenu_Item *temp_item = NULL; - // options image cHudSprite *hud_sprite = new cHudSprite( pMenuCore->m_handler->m_level->m_sprite_manager ); hud_sprite->Set_Image( pVideo->Get_Surface( "menu/options.png" ) ); diff --git a/smc/src/level/level_player.cpp b/smc/src/level/level_player.cpp index c4393c19a..3af72589e 100644 --- a/smc/src/level/level_player.cpp +++ b/smc/src/level/level_player.cpp @@ -44,7 +44,7 @@ namespace SMC { // Milliseconds to enable power jump when ducking -const int power_jump_delta = 1000; +const unsigned int power_jump_delta = 1000; const float cLevel_Player::m_default_pos_x = 200.0f; const float cLevel_Player::m_default_pos_y = -300.0f; diff --git a/smc/src/overworld/world_layer.cpp b/smc/src/overworld/world_layer.cpp index 8a79757de..50f781ab5 100644 --- a/smc/src/overworld/world_layer.cpp +++ b/smc/src/overworld/world_layer.cpp @@ -457,7 +457,8 @@ cLine_collision cLayer :: Get_Nearest( float x, float y, ObjectDirection dir /* cLayer_Line_Point_Start *layer_line = (*itr); // line is not from waypoint - if( only_origin_id >= 0 && only_origin_id != layer_line->m_origin ) + if( only_origin_id >= 0) + if((unsigned)only_origin_id != layer_line->m_origin ) { continue; } diff --git a/smc/src/video/video.cpp b/smc/src/video/video.cpp index a6d250e6e..60b6f571e 100644 --- a/smc/src/video/video.cpp +++ b/smc/src/video/video.cpp @@ -1279,8 +1279,8 @@ cGL_Surface *cVideo :: Load_GL_Surface( std::string filename, bool use_settings SDL_Surface *cVideo :: Convert_To_Final_Software_Image( SDL_Surface *surface ) const { // get power of two size - const unsigned int width = Get_Power_of_2( surface->w ); - const unsigned int height = Get_Power_of_2( surface->h ); + const int width = Get_Power_of_2( surface->w ); + const int height = Get_Power_of_2( surface->h ); // if it needs to be changed if( width != surface->w || height != surface->h || surface->format->BitsPerPixel != 32 ) @@ -1306,7 +1306,7 @@ SDL_Surface *cVideo :: Convert_To_Final_Software_Image( SDL_Surface *surface ) c return surface; } -cGL_Surface *cVideo :: Create_Texture( SDL_Surface *surface, bool mipmap /* = 0 */, unsigned int force_width /* = 0 */, unsigned int force_height /* = 0 */ ) const +cGL_Surface *cVideo :: Create_Texture( SDL_Surface *surface, bool mipmap /* = 0 */,unsigned int force_width /* = 0 */, unsigned int force_height /* = 0 */ ) const { if( !surface ) { @@ -1343,14 +1343,14 @@ cGL_Surface *cVideo :: Create_Texture( SDL_Surface *surface, bool mipmap /* = 0 int height = surface->h; // forced size is set - if( force_width > 0 && force_height > 0 ) + if( force_width != 0 && force_height != 0 ) { // get power of two size force_width = Get_Power_of_2( force_width ); force_height = Get_Power_of_2( force_height ); // apply forced size - if( force_width != width || force_height != height ) + if( force_width != (unsigned)width || force_height != (unsigned)height ) { width = force_width; height = force_height;