From c6ce9f7c7e2dc346573b63775f7237cad219c32d Mon Sep 17 00:00:00 2001 From: grumbel Date: Tue, 17 Nov 2009 16:16:30 +0000 Subject: [PATCH] More -Weffc++ cleanup git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6011 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- src/badguy/badguy.cpp | 3 ++ src/badguy/badguy.hpp | 43 ++++++++++--------- src/control/joystickkeyboardcontroller.cpp | 10 +++-- src/gui/button_group.cpp | 8 +++- src/gui/button_group.hpp | 11 +++-- src/gui/menu.cpp | 33 +++++++++++++-- src/gui/menu.hpp | 67 +++++++++++++++++------------- src/gui/mousecursor.cpp | 7 +++- src/gui/mousecursor.hpp | 7 +++- src/lisp/lexer.cpp | 10 ++++- src/lisp/lexer.hpp | 1 + src/lisp/lisp.cpp | 5 ++- src/lisp/list_iterator.cpp | 6 ++- src/lisp/parser.cpp | 9 +++- src/lisp/parser.hpp | 2 + src/lisp/writer.cpp | 12 +++++- src/lisp/writer.hpp | 1 + src/object/ambient_sound.cpp | 36 ++++++++++++++-- src/object/ambient_sound.hpp | 1 + src/object/background.cpp | 26 ++++++++++-- src/object/electrifier.cpp | 5 ++- src/object/electrifier.hpp | 2 + src/object/rock.cpp | 1 + src/object/skull_tile.cpp | 8 +++- src/object/smoke_cloud.cpp | 2 + src/physfs/physfs_stream.hpp | 8 ++++ src/scripting/wind.hpp | 6 ++- src/sprite/sprite.hpp | 10 ++--- src/supertux/collision.hpp | 20 +++++++-- src/supertux/levelintro.hpp | 4 ++ src/supertux/shrinkfade.cpp | 10 ++++- src/supertux/shrinkfade.hpp | 5 ++- src/supertux/spawn_point.cpp | 9 ++-- src/supertux/textscroller.hpp | 8 ++++ src/video/color.hpp | 10 ++--- src/video/font.cpp | 11 +++-- src/video/font.hpp | 37 ++++++++++------- src/video/gl/gl_texture.cpp | 18 ++++++-- src/video/sdl/sdl_lightmap.cpp | 11 ++++- src/video/sdl/sdl_lightmap.hpp | 10 ++++- src/video/sdl/sdl_texture.hpp | 4 ++ src/worldmap/level.cpp | 5 +++ src/worldmap/level.hpp | 7 ++-- src/worldmap/special_tile.cpp | 15 +++++-- src/worldmap/special_tile.hpp | 3 +- src/worldmap/sprite_change.cpp | 9 +++- src/worldmap/sprite_change.hpp | 48 ++++++++++----------- src/worldmap/teleporter.cpp | 11 +++-- src/worldmap/teleporter.hpp | 4 +- 49 files changed, 426 insertions(+), 173 deletions(-) diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 83ff6f8bc..acdde41fe 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -32,6 +32,7 @@ static const float Y_OFFSCREEN_DISTANCE = 1200; BadGuy::BadGuy(const Vector& pos, const std::string& sprite_name, int layer) : MovingSprite(pos, sprite_name, layer, COLGROUP_DISABLED), + physic(), countMe(true), is_initialized(false), start_position(), @@ -57,6 +58,7 @@ BadGuy::BadGuy(const Vector& pos, const std::string& sprite_name, int layer) : BadGuy::BadGuy(const Vector& pos, Direction direction, const std::string& sprite_name, int layer) : MovingSprite(pos, sprite_name, layer, COLGROUP_DISABLED), + physic(), countMe(true), is_initialized(false), start_position(), @@ -82,6 +84,7 @@ BadGuy::BadGuy(const Vector& pos, Direction direction, const std::string& sprite BadGuy::BadGuy(const Reader& reader, const std::string& sprite_name, int layer) : MovingSprite(reader, sprite_name, layer, COLGROUP_DISABLED), + physic(), countMe(true), is_initialized(false), start_position(), diff --git a/src/badguy/badguy.hpp b/src/badguy/badguy.hpp index 7555d837d..b6aa07516 100644 --- a/src/badguy/badguy.hpp +++ b/src/badguy/badguy.hpp @@ -68,15 +68,12 @@ public: { return start_position; } + void set_start_position(const Vector& vec) { start_position = vec; } - /** Count this badguy to the statistics? This value should not be - changed during runtime. */ - bool countMe; - /** Called when hit by a fire bullet, and is_flammable() returns true */ virtual void ignite(); @@ -132,9 +129,6 @@ protected: /** called each frame when the badguy is not activated. */ virtual void inactive_update(float elapsed_time); - /** true if initialize() has already been called */ - bool is_initialized; - /** called immediately before the first call to initialize */ virtual void initialize(); @@ -163,14 +157,6 @@ protected: pixels. Minimum value for height is 1 pixel */ bool might_fall(int height = 1); - Vector start_position; - - /** The direction we currently face in */ - Direction dir; - - /** The direction we initially faced in */ - Direction start_dir; - /** Get Direction from String. */ Direction str2dir( std::string dir_str ); @@ -190,11 +176,6 @@ protected: from above. */ Vector get_floor_normal(); - bool frozen; - bool ignited; /**< true if this badguy is currently on fire */ - - std::string dead_script; /**< script to execute when badguy is killed */ - /** Returns true if we were in STATE_ACTIVE at the beginning of the last call to update() */ bool is_active(); @@ -208,6 +189,28 @@ private: protected: Physic physic; +public: + /** Count this badguy to the statistics? This value should not be + changed during runtime. */ + bool countMe; + +protected: + /** true if initialize() has already been called */ + bool is_initialized; + + Vector start_position; + + /** The direction we currently face in */ + Direction dir; + + /** The direction we initially faced in */ + Direction start_dir; + + bool frozen; + bool ignited; /**< true if this badguy is currently on fire */ + + std::string dead_script; /**< script to execute when badguy is killed */ + private: State state; diff --git a/src/control/joystickkeyboardcontroller.cpp b/src/control/joystickkeyboardcontroller.cpp index a8b995029..4e14336c5 100644 --- a/src/control/joystickkeyboardcontroller.cpp +++ b/src/control/joystickkeyboardcontroller.cpp @@ -57,10 +57,12 @@ public: JoystickKeyboardController* controller; }; -JoystickKeyboardController::JoystickKeyboardController() - : hat_state(0), - wait_for_key(-1), wait_for_joystick(-1), - key_options_menu(0), joystick_options_menu(0) +JoystickKeyboardController::JoystickKeyboardController() : + hat_state(0), + wait_for_key(-1), + wait_for_joystick(-1), + key_options_menu(0), + joystick_options_menu(0) { // initialize default keyboard map keymap[SDLK_LEFT] = LEFT; diff --git a/src/gui/button_group.cpp b/src/gui/button_group.cpp index 8d38c99e7..0e910e98d 100644 --- a/src/gui/button_group.cpp +++ b/src/gui/button_group.cpp @@ -24,7 +24,13 @@ extern SDL_Surface* g_screen; ButtonGroup::ButtonGroup(Vector pos_, Vector buttons_size_, Vector buttons_box_) : pos(pos_), buttons_size(buttons_size_), - buttons_box(buttons_box_) + buttons_box(buttons_box_), + buttons(), + button_selected(), + row(), + mouse_hover(), + mouse_left_button(), + buttons_pair_nb() { buttons.clear(); row = 0; diff --git a/src/gui/button_group.hpp b/src/gui/button_group.hpp index a9fe1141a..5c52fb517 100644 --- a/src/gui/button_group.hpp +++ b/src/gui/button_group.hpp @@ -43,12 +43,17 @@ public: bool is_hover(); private: - Vector pos, buttons_size, buttons_box; typedef std::vector