# 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
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)
ENDFOREACH(SUPERTUX_LEVEL_DIR)
ADD_CUSTOM_TARGET(
- supertux2-messages ALL
+ supertux2-messages ALL
DEPENDS ${MESSAGES_POT_FILES}
)
## 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} $<TARGET_OBJECTS:supertux2_c>)
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})
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;
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;
bool is_stunned;
float time_stunned;
- std::unique_ptr<SoundSource> ticking;
+ std::unique_ptr<SoundSource> ticking;
std::unique_ptr<SoundSource> grunting;
};
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
case MN_BACK:
MenuManager::instance().pop_menu();
break;
+
default:
break;
}
contents(),
object(0),
hit_counter(1),
+ sprite_name(),
+ script(),
lightsprite()
{
bbox.set_pos(pos);
contents(),
object(0),
hit_counter(1),
+ sprite_name(),
+ script(),
lightsprite()
{
Vector pos;
duck(),
dead(),
dying(),
+ winning(),
backflipping(),
backflip_direction(),
peekingX(),
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(),
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.");
}
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));
std::string worldname;
struct Level
{
+ Level() : fullpath(), name() {}
std::string fullpath;
std::string name;
};
message_timer(),
message_displayed(),
message(),
- fade_tilemap()
+ fade_tilemap(),
+ script()
{
reader.get("x", bbox.p1.x);
reader.get("y", bbox.p1.y);
GLRenderer::GLRenderer() :
window(),
+ glcontext(),
+ viewport(),
desktop_size(0, 0),
fullscreen_active(false),
last_texture(static_cast<GLuint> (-1))
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
SDLLightmap::SDLLightmap() :
renderer(static_cast<SDLRenderer*>(Renderer::instance())->get_sdl_renderer()),
+ texture(),
width(),
height(),
LIGHTMAP_DIV()
#include <SDL.h>
SDLTexture::SDLTexture(SDL_Surface* image) :
- texture()
+ texture(),
+ width(),
+ height()
{
texture = SDL_CreateTextureFromSurface(static_cast<SDLRenderer*>(Renderer::instance())->get_sdl_renderer(),
image);
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);