From 99f3a4dfff6d5ee848579954027c4de0586101ab Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Mon, 13 Jun 2011 13:46:19 +0200 Subject: [PATCH] fixed compiler warnings --- asteroids/Model.cc | 5 ++--- asteroids/View.cc | 5 +---- asteroids/editormain.cc | 5 ++--- engine/Commands.cc | 2 +- engine/IMGUIControls.cc | 12 +++++++++--- engine/SoundBase.h | 4 ++-- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/asteroids/Model.cc b/asteroids/Model.cc index b5e62e7..152475e 100644 --- a/asteroids/Model.cc +++ b/asteroids/Model.cc @@ -392,7 +392,7 @@ bool Model::PullGlobalHighscore(std::stringstream &highscore_stream) { int bytes_sent; bytes_sent = SDLNet_TCP_Send (server_socket, http_query_string.c_str(), http_query_string.size()); - if (bytes_sent != http_query_string.size()) { + if (static_cast(bytes_sent) != http_query_string.size()) { Engine::LogError ("SDL_net tcp send: %s", SDLNet_GetError()); return false; } @@ -501,7 +501,7 @@ bool Model::SubmitGlobalHigscoreEntry (std::string name, const unsigned int poin int bytes_sent; bytes_sent = SDLNet_TCP_Send (server_socket, http_query_string.c_str(), http_query_string.size()); - if (bytes_sent != http_query_string.size()) { + if (static_cast(bytes_sent) != http_query_string.size()) { Engine::LogError ("SDL_net tcp send: %s", SDLNet_GetError()); return false; } @@ -800,7 +800,6 @@ void Model::OnLevelComplete() { // calculate the bonus points float level_time = roundf(mLevelTimeSeconds); float level_par_time = roundf(mLevelParTimeSeconds); - int bonus_points = 0; if (level_time <= level_par_time) { // secret time bonus formula diff --git a/asteroids/View.cc b/asteroids/View.cc index a946528..000e364 100644 --- a/asteroids/View.cc +++ b/asteroids/View.cc @@ -589,8 +589,6 @@ void View::DrawUiGameOver() { text_xpos, text_ypos); - const static int value_width = 10; - text_ypos += 48; // ----- New Score ----- @@ -781,7 +779,6 @@ void View::DrawUiLevelComplete() { if (GetModel()->GetGameModified()) { SelectFont("console.ttf size=23 color=#cc0000"); - float width, height; std::string message ("* UNOFFICIAL GAME * UNOFFICIAL GAME * UNOFFICIAL GAME *"); float xpos = (screen_left) + 5; @@ -951,7 +948,7 @@ void View::DrawUiPlayerDied() { */ void View::DrawHighscoreEntry (float x, float y, float entry_width, const std::string &name, unsigned int points) { const float width_buffer = 30.; - float width, height; + float height; float name_width, points_value_width; // Measure and draw the name diff --git a/asteroids/editormain.cc b/asteroids/editormain.cc index 6417c80..b3b494a 100644 --- a/asteroids/editormain.cc +++ b/asteroids/editormain.cc @@ -88,8 +88,8 @@ std::string find_game_data_dir () { paths.push_back("/usr/local/share/fysxasteroids"); paths.push_back("/usr/share/fysxasteroids"); - std::vector::iterator iter = paths.begin(); - for (iter; iter != paths.end(); iter++) { + std::vector::iterator iter; + for (iter = paths.begin(); iter != paths.end(); iter++) { std::string test_path = *iter; if (!boost::filesystem::is_directory(test_path + "/data/fonts")) @@ -157,7 +157,6 @@ int main (int argc, char* argv[]) { Engine::SetMusicVolume (0.); // Load the icon - Uint32 colorkey; SDL_Surface *image = NULL; image = SDL_LoadBMP("./data/textures/icon.bmp"); if (!image) diff --git a/engine/Commands.cc b/engine/Commands.cc index 80cc16f..bb9290a 100644 --- a/engine/Commands.cc +++ b/engine/Commands.cc @@ -186,7 +186,7 @@ void CommandSetErrorString (const std::string &error_str){ std::string CommandGetErrorString (){ if (!CommandsInitialized ()) - return false; + return std::string(""); return CommandsInstance->GetErrorString(); } diff --git a/engine/IMGUIControls.cc b/engine/IMGUIControls.cc index 442b12a..fa3aaf8 100644 --- a/engine/IMGUIControls.cc +++ b/engine/IMGUIControls.cc @@ -34,7 +34,7 @@ bool regionhit (int x, int y, int w, int h) { void DrawBlock (int x, int y, int w, int h) { const float shading_dark = 0.5f; - const float shading_light = 1.3f; + // const float shading_light = 1.3f; float color[4]; glGetFloatv (GL_CURRENT_COLOR, color); @@ -297,6 +297,8 @@ bool Button (int id, const char* caption, int x, int y, int w, int h) { controller->uistate.kbditem = 0; return true; break; + default: + break; } } @@ -418,6 +420,8 @@ bool CheckButton (int id, const char* caption, bool checked, int x, int y, int w return true; break; + default: + break; } } @@ -541,7 +545,7 @@ bool LineEdit (int id, int x, int y, std::string &text_value, const int &maxleng break; default: // The raw input processing - if (maxlength > 0 && text_value.size() < maxlength) { + if (maxlength > 0 && static_cast(text_value.size()) < maxlength) { if (controller->uistate.last_unicode) { if ((controller->uistate.last_unicode & 0xFF80) == 0) { // we do not want to add special characters such as backspaces @@ -681,7 +685,7 @@ bool LineEditMasked (int id, int x, int y, std::string &text_value, const int &m break; default: // The raw input processing - if (maxlength > 0 && text_value.size() < maxlength) { + if (maxlength > 0 && static_cast(text_value.size()) < maxlength) { if (controller->uistate.last_unicode) { if ((controller->uistate.last_unicode & 0xFF80) == 0) { char c = controller->uistate.last_unicode & 0x7F; @@ -789,6 +793,8 @@ float VerticalSlider (int id, int x, int y, int w, int h, float min_value, float controller->uistate.last_keysym = SDLK_CLEAR; return true; break; + default: + break; } } diff --git a/engine/SoundBase.h b/engine/SoundBase.h index 14a36b2..2933e42 100644 --- a/engine/SoundBase.h +++ b/engine/SoundBase.h @@ -11,8 +11,8 @@ class Module; class SoundSample { public: SoundSample() : - mMixChunk (NULL), - mChannel (-1) { + mChannel (-1), + mMixChunk (NULL) { } ~SoundSample();