From: Ingo Ruhnke Date: Tue, 17 Nov 2009 16:16:30 +0000 (+0000) Subject: More -Weffc++ cleanup X-Git-Url: https://git.octo.it/?a=commitdiff_plain;ds=sidebyside;h=12a28b64dcce9c7ff706451b4f3aecd201cc8a5f;p=supertux.git More -Weffc++ cleanup SVN-Revision: 6011 --- 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