diff --git a/CMakeLists.txt b/CMakeLists.txt index d4b606dc92e..c3f73712c00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -255,9 +255,13 @@ IF(CMAKE_COMPILER_IS_GNUCC) REMOVE_DEFINITIONS(-Werror) ENDIF(WERROR) IF(WARNINGS) - ADD_DEFINITIONS(-fdiagnostics-show-option -pedantic -Wno-long-long -Wcast-align -Wdisabled-optimization -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wredundant-decls -Wstack-protector -Wconversion -Wundef -Wsign-conversion -Wshadow -Winline -Wunsafe-loop-optimizations -Wfloat-equal -Wswitch-default -Wswitch-enum -Wcast-qual -Wsign-promo -Woverloaded-virtual -Wmissing-format-attribute -Wstrict-overflow=5 -Wformat=2-Weffc++ -Wabi -Wctor-dtor-privacy -Wstrict-null-sentinel -Wno-unused-parameter) - # -ansi fails in MinGW - # still left: -Wold-style-cast -Wpadded + # temporarily disabled: + # -Wsign-conversion -Wfloat-equal -Wconversion -Wundef -Wshadow -Wswitch-default + # -Wswitch-enum -Wsign-promo -Wcast-qual -Woverloaded-virtual -Wmissing-format-attribute + # -Wold-style-cast -Wpadded + # fails on MinGW: + # -ansi + SET(SUPERTUX2_EXTRA_WARNING_FLAGS "-fdiagnostics-show-option -pedantic -Wno-long-long -Wcast-align -Wdisabled-optimization -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wredundant-decls -Wstack-protector -Winline -Wunsafe-loop-optimizations -Wstrict-overflow=5 -Wformat=2 -Weffc++ -Wabi -Wctor-dtor-privacy -Wstrict-null-sentinel -Wno-unused-parameter") ENDIF(WARNINGS) ENDIF(CMAKE_COMPILER_IS_GNUCC) @@ -307,7 +311,7 @@ IF(GENERATE_MESSAGESPOT) ENDFOREACH(SUPERTUX_LEVEL_DIR) ADD_CUSTOM_TARGET( - supertux2-messages ALL + supertux2-messages ALL DEPENDS ${MESSAGES_POT_FILES} ) @@ -350,13 +354,15 @@ SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) ## Add target for supertux binary -ADD_EXECUTABLE(supertux2 ${CMAKE_BINARY_DIR}/version.h ${SUPERTUX_SOURCES_C} ${SUPERTUX_SOURCES_CXX} ${TINYGETTEXT_SOURCES_CXX}) +ADD_LIBRARY(supertux2_c OBJECT ${SUPERTUX_SOURCES_C}) +ADD_EXECUTABLE(supertux2 ${CMAKE_BINARY_DIR}/version.h ${SUPERTUX_SOURCES_CXX} ${TINYGETTEXT_SOURCES_CXX} $) ADD_DEPENDENCIES(supertux2 gitversion) +SET_TARGET_PROPERTIES(supertux2 PROPERTIES COMPILE_FLAGS "${SUPERTUX2_EXTRA_WARNING_FLAGS}") ## Link supertux binary with squirrel and other libraries -TARGET_INCLUDE_DIRECTORIES(supertux2 PUBLIC ${SDL2_INCLUDE_DIRS}) -TARGET_INCLUDE_DIRECTORIES(supertux2 PUBLIC ${SDL2IMAGE_INCLUDE_DIRS}) +TARGET_INCLUDE_DIRECTORIES(supertux2 SYSTEM PUBLIC ${SDL2_INCLUDE_DIRS}) +TARGET_INCLUDE_DIRECTORIES(supertux2 SYSTEM PUBLIC ${SDL2IMAGE_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(supertux2 ${SDL2_LIBRARIES}) TARGET_LINK_LIBRARIES(supertux2 ${SDL2IMAGE_LIBRARIES}) diff --git a/src/badguy/goldbomb.cpp b/src/badguy/goldbomb.cpp index 60cc90f79cc..c177a992847 100644 --- a/src/badguy/goldbomb.cpp +++ b/src/badguy/goldbomb.cpp @@ -31,7 +31,8 @@ GoldBomb::GoldBomb(const Reader& reader) : WalkingBadguy(reader, "images/creatures/gold_bomb/gold_bomb.sprite", "left", "right"), tstate(STATE_NORMAL), grabbed(false), - grabber(NULL) + grabber(NULL), + ticking() { walk_speed = 80; max_drop_height = 16; diff --git a/src/badguy/haywire.cpp b/src/badguy/haywire.cpp index b968de57da0..d1bfa580432 100644 --- a/src/badguy/haywire.cpp +++ b/src/badguy/haywire.cpp @@ -34,7 +34,9 @@ Haywire::Haywire(const Reader& reader) : is_exploding(false), time_until_explosion(0.0f), is_stunned(false), - time_stunned(0.0f) + time_stunned(0.0f), + ticking(), + grunting() { walk_speed = 80; max_drop_height = 16; diff --git a/src/badguy/haywire.hpp b/src/badguy/haywire.hpp index 5e4817d1502..c7a1e54dca2 100644 --- a/src/badguy/haywire.hpp +++ b/src/badguy/haywire.hpp @@ -44,7 +44,7 @@ class Haywire : public WalkingBadguy bool is_stunned; float time_stunned; - std::unique_ptr ticking; + std::unique_ptr ticking; std::unique_ptr grunting; }; diff --git a/src/badguy/livefire.cpp b/src/badguy/livefire.cpp index cc5011c1f41..46b0ba59e28 100644 --- a/src/badguy/livefire.cpp +++ b/src/badguy/livefire.cpp @@ -26,13 +26,13 @@ LiveFire::LiveFire(const Reader& reader) : WalkingBadguy(reader, "images/creatures/livefire/livefire.sprite", "left", "right"), lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-medium.sprite")), + death_sound("sounds/fall.wav"), state(STATE_WALKING) { walk_speed = 80; max_drop_height = 20; lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE)); lightsprite->set_color(Color(1.0f, 0.9f, 0.8f)); - death_sound = "sounds/fall.wav"; } void diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index 7acd17f9063..d26a7827a70 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -327,6 +327,7 @@ Menu::process_input() case MN_BACK: MenuManager::instance().pop_menu(); break; + default: break; } diff --git a/src/object/bonus_block.cpp b/src/object/bonus_block.cpp index 83cab765cfe..8b53826ec73 100644 --- a/src/object/bonus_block.cpp +++ b/src/object/bonus_block.cpp @@ -45,6 +45,8 @@ BonusBlock::BonusBlock(const Vector& pos, int data) : contents(), object(0), hit_counter(1), + sprite_name(), + script(), lightsprite() { bbox.set_pos(pos); @@ -85,6 +87,8 @@ BonusBlock::BonusBlock(const Reader& lisp) : contents(), object(0), hit_counter(1), + sprite_name(), + script(), lightsprite() { Vector pos; diff --git a/src/object/player.cpp b/src/object/player.cpp index 2dbc8efccef..02aed87f49c 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -117,6 +117,7 @@ Player::Player(PlayerStatus* _player_status, const std::string& name) : duck(), dead(), dying(), + winning(), backflipping(), backflip_direction(), peekingX(), diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp index 69e5fdec9b3..50e235d4c89 100644 --- a/src/supertux/game_session.cpp +++ b/src/supertux/game_session.cpp @@ -46,14 +46,14 @@ GameSession::GameSession(const std::string& levelfile_, PlayerStatus* player_status, Statistics* statistics) : level(), - statistics_backdrop(), + statistics_backdrop(Surface::create("images/engine/menu/score-backdrop.png")), scripts(), - currentsector(0), + currentsector(nullptr), levelnb(), pause_menu_frame(), end_sequence(0), - game_pause(), - speed_before_pause(), + game_pause(false), + speed_before_pause(g_screen_manager->get_speed()), levelfile(levelfile_), reset_sector(), reset_pos(), @@ -67,15 +67,12 @@ GameSession::GameSession(const std::string& levelfile_, PlayerStatus* player_sta demo_controller(0), play_time(0), edit_mode(false), - levelintro_shown(false) + levelintro_shown(false), + coins_at_start(), + bonus_at_start(), + max_fire_bullets_at_start(), + max_ice_bullets_at_start() { - currentsector = NULL; - - game_pause = false; - speed_before_pause = g_screen_manager->get_speed(); - - statistics_backdrop = Surface::create("images/engine/menu/score-backdrop.png"); - if (restart_level() != 0) throw std::runtime_error ("Initializing the level failed."); } diff --git a/src/supertux/title_screen.cpp b/src/supertux/title_screen.cpp index 681e3e3b7c8..62d810e5842 100644 --- a/src/supertux/title_screen.cpp +++ b/src/supertux/title_screen.cpp @@ -43,7 +43,8 @@ TitleScreen::TitleScreen(PlayerStatus* player_status) : frame(), controller(), - titlesession() + titlesession(), + copyright_text() { controller.reset(new CodeController()); titlesession.reset(new GameSession("levels/misc/menu.stl", player_status)); diff --git a/src/supertux/world.hpp b/src/supertux/world.hpp index c976c603788..4200ed9840c 100644 --- a/src/supertux/world.hpp +++ b/src/supertux/world.hpp @@ -59,6 +59,7 @@ class World std::string worldname; struct Level { + Level() : fullpath(), name() {} std::string fullpath; std::string name; }; diff --git a/src/trigger/secretarea_trigger.cpp b/src/trigger/secretarea_trigger.cpp index 8bddf8c699a..b35643032be 100644 --- a/src/trigger/secretarea_trigger.cpp +++ b/src/trigger/secretarea_trigger.cpp @@ -32,7 +32,8 @@ SecretAreaTrigger::SecretAreaTrigger(const Reader& reader) : message_timer(), message_displayed(), message(), - fade_tilemap() + fade_tilemap(), + script() { reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); diff --git a/src/video/gl/gl_renderer.cpp b/src/video/gl/gl_renderer.cpp index 849006bd8ac..6dc1df3401d 100644 --- a/src/video/gl/gl_renderer.cpp +++ b/src/video/gl/gl_renderer.cpp @@ -37,6 +37,8 @@ GLRenderer::GLRenderer() : window(), + glcontext(), + viewport(), desktop_size(0, 0), fullscreen_active(false), last_texture(static_cast (-1)) diff --git a/src/video/gl/gl_renderer.hpp b/src/video/gl/gl_renderer.hpp index dd07e82f797..13bc6f995d0 100644 --- a/src/video/gl/gl_renderer.hpp +++ b/src/video/gl/gl_renderer.hpp @@ -132,6 +132,10 @@ class GLRenderer : public Renderer Vector to_logical(int physical_x, int physical_y); void set_gamma(float gamma); SDL_Window* get_window() const { return window; } + +private: + GLRenderer(const GLRenderer&) = delete; + GLRenderer& operator=(const GLRenderer&) = delete; }; #endif diff --git a/src/video/sdl/sdl_lightmap.cpp b/src/video/sdl/sdl_lightmap.cpp index 2630a725e8f..794b918d62f 100644 --- a/src/video/sdl/sdl_lightmap.cpp +++ b/src/video/sdl/sdl_lightmap.cpp @@ -24,6 +24,7 @@ SDLLightmap::SDLLightmap() : renderer(static_cast(Renderer::instance())->get_sdl_renderer()), + texture(), width(), height(), LIGHTMAP_DIV() diff --git a/src/video/sdl/sdl_texture.cpp b/src/video/sdl/sdl_texture.cpp index 6093e3d41c4..853bef2bfac 100644 --- a/src/video/sdl/sdl_texture.cpp +++ b/src/video/sdl/sdl_texture.cpp @@ -29,7 +29,9 @@ #include SDLTexture::SDLTexture(SDL_Surface* image) : - texture() + texture(), + width(), + height() { texture = SDL_CreateTextureFromSurface(static_cast(Renderer::instance())->get_sdl_renderer(), image); diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index dafa8d13282..e9e66f65fa3 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -104,7 +104,9 @@ WorldMap::WorldMap(const std::string& filename, PlayerStatus* player_status, con force_spawnpoint(force_spawnpoint), in_level(false), pan_pos(), - panning(false) + panning(false), + last_position(), + last_target_time() { tux = new Tux(this); add_object(tux);