From: grumbel Date: Tue, 17 Nov 2009 17:04:31 +0000 (+0000) Subject: More -Weffc++ cleanup X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ff3e770501eef676aa964edaedd634e90d745012;p=supertux.git More -Weffc++ cleanup git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6012 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/src/control/joystickkeyboardcontroller.cpp b/src/control/joystickkeyboardcontroller.cpp index 4e14336c5..6127e2df7 100644 --- a/src/control/joystickkeyboardcontroller.cpp +++ b/src/control/joystickkeyboardcontroller.cpp @@ -41,8 +41,13 @@ public: void update_menu_item(Control id); virtual void menu_action(MenuItem* item); JoystickKeyboardController* controller; + private: void recreateMenu(); + +private: + JoystickMenu(const JoystickMenu&); + JoystickMenu& operator=(const JoystickMenu&); }; class JoystickKeyboardController::KeyboardMenu : public Menu @@ -55,10 +60,27 @@ public: std::string get_key_name(SDLKey key); virtual void menu_action(MenuItem* item); JoystickKeyboardController* controller; + +private: + KeyboardMenu(const KeyboardMenu&); + KeyboardMenu& operator=(const KeyboardMenu&); }; JoystickKeyboardController::JoystickKeyboardController() : + keymap(), + joy_button_map(), + joy_axis_map(), + joy_hat_map(), + joysticks(), + name(), + dead_zone(), + min_joybuttons(), + max_joybuttons(), + max_joyaxis(), + max_joyhats(), hat_state(0), + jump_with_up_joy(), + jump_with_up_kbd(), wait_for_key(-1), wait_for_joystick(-1), key_options_menu(0), diff --git a/src/control/joystickkeyboardcontroller.hpp b/src/control/joystickkeyboardcontroller.hpp index 49da0a2fb..5af4263db 100644 --- a/src/control/joystickkeyboardcontroller.hpp +++ b/src/control/joystickkeyboardcontroller.hpp @@ -58,16 +58,39 @@ private: void print_joystick_mappings(); + SDLKey reversemap_key(Control c); + int reversemap_joybutton(Control c); + int reversemap_joyaxis(Control c); + int reversemap_joyhat(Control c); + + void unbind_joystick_control(Control c); + + void bind_joybutton(int button, Control c); + void bind_joyaxis(int axis, Control c); + void bind_joyhat(int dir, Control c); + void bind_key(SDLKey key, Control c); + + void set_joy_controls(Control id, bool value); + +private: + class KeyboardMenu; + class JoystickMenu; + + friend class KeyboardMenu; + friend class JoystickMenu; + typedef std::map KeyMap; + typedef std::map ButtonMap; + typedef std::map AxisMap; + typedef std::map HatMap; + +private: KeyMap keymap; - typedef std::map ButtonMap; ButtonMap joy_button_map; - typedef std::map AxisMap; AxisMap joy_axis_map; - typedef std::map HatMap; HatMap joy_hat_map; std::vector joysticks; @@ -89,30 +112,11 @@ private: bool jump_with_up_joy; // Joystick up jumps bool jump_with_up_kbd; // Keyboard up jumps - SDLKey reversemap_key(Control c); - int reversemap_joybutton(Control c); - int reversemap_joyaxis(Control c); - int reversemap_joyhat(Control c); - - void unbind_joystick_control(Control c); - - void bind_joybutton(int button, Control c); - void bind_joyaxis(int axis, Control c); - void bind_joyhat(int dir, Control c); - void bind_key(SDLKey key, Control c); - - void set_joy_controls(Control id, bool value); - int wait_for_key; int wait_for_joystick; - class KeyboardMenu; - class JoystickMenu; - KeyboardMenu* key_options_menu; JoystickMenu* joystick_options_menu; - friend class KeyboardMenu; - friend class JoystickMenu; private: JoystickKeyboardController(const JoystickKeyboardController&); diff --git a/src/gui/button.cpp b/src/gui/button.cpp index a4f5fa099..937bf6ceb 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -36,10 +36,37 @@ Button::Button(Surface* image_, std::string info_, SDLKey binding_) : info = info_; } +Button::Button(const Button& rhs) : + pos(rhs.pos), + size(rhs.size), + image(rhs.image), + binding(rhs.binding), + id(rhs.id), + state(rhs.state), + info(rhs.info) +{ +} + Button::~Button() { } +Button& +Button::operator=(const Button& rhs) +{ + if (this != &rhs) + { + pos = rhs.pos; + size = rhs.size; + image = rhs.image; + binding = rhs.binding; + id = rhs.id; + state = rhs.state; + info = rhs.info; + } + return *this; +} + void Button::draw(DrawingContext &context, bool selected) { if(selected) diff --git a/src/gui/button.hpp b/src/gui/button.hpp index 405b25b4f..0194dc886 100644 --- a/src/gui/button.hpp +++ b/src/gui/button.hpp @@ -39,8 +39,11 @@ class Button { public: Button(Surface* image_, std::string info_, SDLKey binding_); + Button(const Button& rhs); ~Button(); + Button& operator=(const Button& rhs); + void draw(DrawingContext& context, bool selected); int event(SDL_Event& event, int x_offset = 0, int y_offset = 0); @@ -49,6 +52,7 @@ public: private: friend class ButtonGroup; +private: Vector pos; Vector size; diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index dfafa44b5..158bb069b 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -171,7 +171,8 @@ MenuItem::MenuItem(MenuItemKind _kind, int _id) : help(), list(), selected(), - target_menu() + target_menu(), + input_flickering() { toggled = false; selected = false; diff --git a/src/math/random_generator.cpp b/src/math/random_generator.cpp index 83d424b51..f1f846bcf 100644 --- a/src/math/random_generator.cpp +++ b/src/math/random_generator.cpp @@ -43,7 +43,17 @@ RandomGenerator systemRandom; // global random number generator -RandomGenerator::RandomGenerator() { +RandomGenerator::RandomGenerator() : + initialized(), + fptr(), + rptr(), + state(), + rand_type(), + rand_deg(), + rand_sep(), + end_ptr(), + debug() +{ assert(sizeof(int) >= 4); initialized = 0; debug = 0; // change this by hand for debug diff --git a/src/object/ambient_sound.hpp b/src/object/ambient_sound.hpp index cd8eb74de..fc7bd1f9a 100644 --- a/src/object/ambient_sound.hpp +++ b/src/object/ambient_sound.hpp @@ -103,6 +103,10 @@ private: float currentvolume; /// how loud we are float * volume_ptr; /// this will be used by the volume adjustment effect. + +private: + AmbientSound(const AmbientSound&); + AmbientSound& operator=(const AmbientSound&); }; #endif diff --git a/src/object/bicycle_platform.cpp b/src/object/bicycle_platform.cpp index fd63365c2..c66ee3e6f 100644 --- a/src/object/bicycle_platform.cpp +++ b/src/object/bicycle_platform.cpp @@ -27,9 +27,11 @@ BicyclePlatform::BicyclePlatform(const Reader& reader) : MovingSprite(reader, LAYER_OBJECTS, COLGROUP_STATIC), master(0), slave(0), + center(), radius(128), angle(0), angular_speed(0), + contacts(), momentum(0) { center = get_pos(); @@ -43,6 +45,7 @@ BicyclePlatform::BicyclePlatform(BicyclePlatform* master) : radius(master->radius), angle(master->angle + M_PI), angular_speed(0), + contacts(), momentum(0) { set_pos(get_pos() + Vector(master->get_bbox().get_width(), 0)); diff --git a/src/object/bicycle_platform.hpp b/src/object/bicycle_platform.hpp index 3236065f9..569b16a68 100644 --- a/src/object/bicycle_platform.hpp +++ b/src/object/bicycle_platform.hpp @@ -42,6 +42,9 @@ protected: std::set contacts; /**< objects that are currently pushing on the platform */ float momentum; /** angular momentum in rad per second per second*/ +private: + BicyclePlatform(const BicyclePlatform&); + BicyclePlatform& operator=(const BicyclePlatform&); }; #endif diff --git a/src/object/block.cpp b/src/object/block.cpp index f5ba2d876..dd57c25c1 100644 --- a/src/object/block.cpp +++ b/src/object/block.cpp @@ -159,6 +159,7 @@ Block::start_break(GameObject* hitter) BonusBlock::BonusBlock(const Vector& pos, int data) : Block(sprite_manager->create("images/objects/bonus_block/bonusblock.sprite")), + contents(), object(0) { bbox.set_pos(pos); @@ -177,7 +178,9 @@ BonusBlock::BonusBlock(const Vector& pos, int data) : } BonusBlock::BonusBlock(const Reader& lisp) : - Block(sprite_manager->create("images/objects/bonus_block/bonusblock.sprite")) + Block(sprite_manager->create("images/objects/bonus_block/bonusblock.sprite")), + contents(), + object(0) { Vector pos; diff --git a/src/object/block.hpp b/src/object/block.hpp index fd06c2ca7..d31ba4d8c 100644 --- a/src/object/block.hpp +++ b/src/object/block.hpp @@ -74,12 +74,16 @@ public: CONTENT_CUSTOM }; - Contents contents; protected: virtual void hit(Player& player); -private: +public: + Contents contents; MovingObject* object; + +private: + BonusBlock(const BonusBlock&); + BonusBlock& operator=(const BonusBlock&); }; class Brick : public Block diff --git a/src/object/bouncy_coin.cpp b/src/object/bouncy_coin.cpp index d73715184..d89b56822 100644 --- a/src/object/bouncy_coin.cpp +++ b/src/object/bouncy_coin.cpp @@ -25,7 +25,9 @@ static const float FADE_TIME = .2f; static const float LIFE_TIME = .5f; BouncyCoin::BouncyCoin(const Vector& pos, bool emerge) : + sprite(), position(pos), + timer(), emerge_distance(0) { timer.start(LIFE_TIME); diff --git a/src/object/broken_brick.cpp b/src/object/broken_brick.cpp index da6cdf0c3..bdf3db229 100644 --- a/src/object/broken_brick.cpp +++ b/src/object/broken_brick.cpp @@ -21,6 +21,7 @@ BrokenBrick::BrokenBrick(std::auto_ptr sprite, const Vector& pos, const Vector& nmovement) : + timer(), sprite(sprite), position(pos), movement(nmovement) diff --git a/src/object/bullet.cpp b/src/object/bullet.cpp index 62baac062..2161e3be0 100644 --- a/src/object/bullet.cpp +++ b/src/object/bullet.cpp @@ -25,8 +25,11 @@ const float BULLET_XM = 600; const float BULLET_STARTING_YM = 0; } -Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type) - : life_count(3), type(type) +Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type) : + physic(), + life_count(3), + sprite(), + type(type) { float speed = dir == RIGHT ? BULLET_XM : -BULLET_XM; physic.set_velocity_x(speed + xm); diff --git a/src/object/endsequence.cpp b/src/object/endsequence.cpp index a9932562e..df0a69051 100644 --- a/src/object/endsequence.cpp +++ b/src/object/endsequence.cpp @@ -19,10 +19,12 @@ #include "object/player.hpp" #include "supertux/sector.hpp" -EndSequence::EndSequence() - : isrunning(false), isdone(false), tux_may_walk(true) -{ - end_sequence_controller = 0; +EndSequence::EndSequence() : + isrunning(false), + isdone(false), + tux_may_walk(true), + end_sequence_controller(0) +{ } EndSequence::~EndSequence() diff --git a/src/object/endsequence.hpp b/src/object/endsequence.hpp index e05ae7ea3..f9f2aceb0 100644 --- a/src/object/endsequence.hpp +++ b/src/object/endsequence.hpp @@ -40,6 +40,7 @@ protected: virtual void running(float elapsed_time); /**< called while the EndSequence is running */ virtual void stopping(); /**< called when EndSequence stops */ +protected: bool isrunning; /**< true while EndSequence plays */ bool isdone; /**< true if EndSequence has finished playing */ bool tux_may_walk; /**< true while tux is allowed to walk */ diff --git a/src/object/endsequence_walkleft.cpp b/src/object/endsequence_walkleft.cpp index 0ee8e7441..809b8ba7c 100644 --- a/src/object/endsequence_walkleft.cpp +++ b/src/object/endsequence_walkleft.cpp @@ -19,8 +19,10 @@ #include "supertux/mainloop.hpp" #include "supertux/sector.hpp" -EndSequenceWalkLeft::EndSequenceWalkLeft() - : EndSequence() +EndSequenceWalkLeft::EndSequenceWalkLeft() : + EndSequence(), + last_x_pos(), + endsequence_timer() { } diff --git a/src/object/endsequence_walkleft.hpp b/src/object/endsequence_walkleft.hpp index 27a9ae77a..fd5de6641 100644 --- a/src/object/endsequence_walkleft.hpp +++ b/src/object/endsequence_walkleft.hpp @@ -32,6 +32,7 @@ protected: virtual void running(float elapsed_time); /**< called while the EndSequence is running */ virtual void stopping(); /**< called when EndSequence stops */ +private: float last_x_pos; Timer endsequence_timer; }; diff --git a/src/object/endsequence_walkright.cpp b/src/object/endsequence_walkright.cpp index 4dafb39fc..581297542 100644 --- a/src/object/endsequence_walkright.cpp +++ b/src/object/endsequence_walkright.cpp @@ -19,8 +19,10 @@ #include "supertux/mainloop.hpp" #include "supertux/sector.hpp" -EndSequenceWalkRight::EndSequenceWalkRight() - : EndSequence() +EndSequenceWalkRight::EndSequenceWalkRight() : + EndSequence(), + last_x_pos(), + endsequence_timer() { } diff --git a/src/object/endsequence_walkright.hpp b/src/object/endsequence_walkright.hpp index 39da58355..cc06785a9 100644 --- a/src/object/endsequence_walkright.hpp +++ b/src/object/endsequence_walkright.hpp @@ -32,6 +32,7 @@ protected: virtual void running(float elapsed_time); /**< called while the EndSequence is running */ virtual void stopping(); /**< called when EndSequence stops */ +private: float last_x_pos; Timer endsequence_timer; }; diff --git a/src/object/falling_coin.cpp b/src/object/falling_coin.cpp index c6545f9aa..73b9302ff 100644 --- a/src/object/falling_coin.cpp +++ b/src/object/falling_coin.cpp @@ -19,7 +19,10 @@ #include "sprite/sprite_manager.hpp" #include "supertux/main.hpp" -FallingCoin::FallingCoin(const Vector& start_position, const int vel_x) +FallingCoin::FallingCoin(const Vector& start_position, const int vel_x) : + physic(), + pos(), + sprite() { pos = start_position; sprite = sprite_manager->create("images/objects/coin/coin.sprite"); diff --git a/src/object/gradient.cpp b/src/object/gradient.cpp index 2a785f6b1..896f30b10 100644 --- a/src/object/gradient.cpp +++ b/src/object/gradient.cpp @@ -19,12 +19,16 @@ #include "util/reader.hpp" Gradient::Gradient() : - layer(LAYER_BACKGROUND0) + layer(LAYER_BACKGROUND0), + gradient_top(), + gradient_bottom() { } Gradient::Gradient(const Reader& reader) : - layer(LAYER_BACKGROUND0) + layer(LAYER_BACKGROUND0), + gradient_top(), + gradient_bottom() { reader.get("layer", layer); std::vector bkgd_top_color, bkgd_bottom_color; diff --git a/src/object/gradient.hpp b/src/object/gradient.hpp index de26707ef..aab61be05 100644 --- a/src/object/gradient.hpp +++ b/src/object/gradient.hpp @@ -44,7 +44,8 @@ public: private: int layer; - Color gradient_top, gradient_bottom; + Color gradient_top; + Color gradient_bottom; }; #endif /*SUPERTUX_BACKGROUND_H*/ diff --git a/src/object/growup.cpp b/src/object/growup.cpp index d460feb45..4990cf09b 100644 --- a/src/object/growup.cpp +++ b/src/object/growup.cpp @@ -19,7 +19,8 @@ #include "object/player.hpp" GrowUp::GrowUp(Direction direction) : - MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING) + MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING), + physic() { physic.enable_gravity(true); physic.set_velocity_x((direction == LEFT)?-100:100); diff --git a/src/object/icecrusher.cpp b/src/object/icecrusher.cpp index d86f4dd8c..1d7663f65 100644 --- a/src/object/icecrusher.cpp +++ b/src/object/icecrusher.cpp @@ -27,9 +27,11 @@ const float DROP_SPEED = 500; const float RECOVER_SPEED = 200; } -IceCrusher::IceCrusher(const Reader& reader) - : MovingSprite(reader, "images/creatures/icecrusher/icecrusher.sprite", LAYER_OBJECTS, COLGROUP_STATIC), - state(IDLE), speed(Vector(0,0)) +IceCrusher::IceCrusher(const Reader& reader) : + MovingSprite(reader, "images/creatures/icecrusher/icecrusher.sprite", LAYER_OBJECTS, COLGROUP_STATIC), + state(IDLE), + start_position(), + speed(Vector(0,0)) { start_position = get_bbox().p1; set_state(state, true); diff --git a/src/object/infoblock.cpp b/src/object/infoblock.cpp index 9b9e5ae51..13ad9a2ca 100644 --- a/src/object/infoblock.cpp +++ b/src/object/infoblock.cpp @@ -32,8 +32,11 @@ const float HEIGHT = 200; InfoBlock::InfoBlock(const Reader& lisp) : Block(sprite_manager->create("images/objects/bonus_block/infoblock.sprite")), + message(), shown_pct(0), - dest_pct(0) + dest_pct(0), + lines(), + lines_height() { Vector pos; lisp.get("x", pos.x); diff --git a/src/object/infoblock.hpp b/src/object/infoblock.hpp index 28157ae41..91ae5baf0 100644 --- a/src/object/infoblock.hpp +++ b/src/object/infoblock.hpp @@ -33,14 +33,14 @@ public: protected: virtual void hit(Player& player); + Player* get_nearest_player(); + +protected: std::string message; //AmbientSound* ringing; //bool stopped; float shown_pct; /**< Value in the range of 0..1, depending on how much of the infobox is currently shown */ float dest_pct; /**< With each call to update(), shown_pct will slowly transition to this value */ - - Player* get_nearest_player(); - std::vector lines; /**< lines of text (or images) to display */ float lines_height; }; diff --git a/src/object/invisible_wall.cpp b/src/object/invisible_wall.cpp index d0edd6408..beb41a9a2 100644 --- a/src/object/invisible_wall.cpp +++ b/src/object/invisible_wall.cpp @@ -19,8 +19,11 @@ #include "supertux/object_factory.hpp" #include "util/reader.hpp" -InvisibleWall::InvisibleWall(const Reader& lisp) - : MovingSprite(lisp, "images/objects/invisible/invisible.sprite", LAYER_TILES, COLGROUP_STATIC), width(32), height(32) +InvisibleWall::InvisibleWall(const Reader& lisp) : + MovingSprite(lisp, "images/objects/invisible/invisible.sprite", LAYER_TILES, COLGROUP_STATIC), + physic(), + width(32), + height(32) { lisp.get("width", width); lisp.get("height", height); diff --git a/src/object/ispy.cpp b/src/object/ispy.cpp index 5a9335099..3d0c16969 100644 --- a/src/object/ispy.cpp +++ b/src/object/ispy.cpp @@ -23,8 +23,11 @@ #include "supertux/sector.hpp" #include "supertux/tile.hpp" -Ispy::Ispy(const Reader& reader) - : MovingSprite(reader, "images/objects/ispy/ispy.sprite", LAYER_TILES+5, COLGROUP_DISABLED), state(ISPYSTATE_IDLE), dir(AUTO) +Ispy::Ispy(const Reader& reader) : + MovingSprite(reader, "images/objects/ispy/ispy.sprite", LAYER_TILES+5, COLGROUP_DISABLED), + state(ISPYSTATE_IDLE), + script(), + dir(AUTO) { // read script to execute reader.get("script", script); diff --git a/src/object/light.cpp b/src/object/light.cpp index 5d7765dde..bd00ceff7 100644 --- a/src/object/light.cpp +++ b/src/object/light.cpp @@ -18,7 +18,10 @@ #include "sprite/sprite.hpp" #include "sprite/sprite_manager.hpp" -Light::Light(const Vector& center, const Color& color) : position(center), color(color) +Light::Light(const Vector& center, const Color& color) : + position(center), + color(color), + sprite() { sprite = sprite_manager->create("images/objects/lightmap_light/lightmap_light.sprite"); } diff --git a/src/object/magicblock.cpp b/src/object/magicblock.cpp index f98fca291..ab3d64759 100644 --- a/src/object/magicblock.cpp +++ b/src/object/magicblock.cpp @@ -35,9 +35,12 @@ const float MIN_SOLIDTIME = 1.0f; const float SWITCH_DELAY = 0.1f; /**< seconds to wait for stable conditions until switching solidity */ } -MagicBlock::MagicBlock(const Reader& lisp) - : MovingSprite(lisp, "images/objects/magicblock/magicblock.sprite"), - is_solid(false), solid_time(0), switch_delay(0), light(1.0f,1.0f,1.0f) +MagicBlock::MagicBlock(const Reader& lisp) : + MovingSprite(lisp, "images/objects/magicblock/magicblock.sprite"), + is_solid(false), + solid_time(0), + switch_delay(0), + light(1.0f,1.0f,1.0f) { set_group(COLGROUP_STATIC); //get color from lisp diff --git a/src/object/pneumatic_platform.hpp b/src/object/pneumatic_platform.hpp index ca636e4c2..80b1449ca 100644 --- a/src/object/pneumatic_platform.hpp +++ b/src/object/pneumatic_platform.hpp @@ -40,6 +40,9 @@ protected: float speed_y; /**< vertical speed */ std::set contacts; /**< objects that are currently pushing on the platform */ +private: + PneumaticPlatform(const PneumaticPlatform&); + PneumaticPlatform& operator=(const PneumaticPlatform&); }; #endif diff --git a/src/object/powerup.cpp b/src/object/powerup.cpp index 3eebf6556..f4af4abe0 100644 --- a/src/object/powerup.cpp +++ b/src/object/powerup.cpp @@ -22,7 +22,10 @@ #include "util/reader.hpp" PowerUp::PowerUp(const Reader& lisp) : - MovingSprite(lisp, LAYER_OBJECTS, COLGROUP_MOVING) + MovingSprite(lisp, LAYER_OBJECTS, COLGROUP_MOVING), + physic(), + script(), + no_physics() { lisp.get("script", script); no_physics = false; diff --git a/src/object/pushbutton.cpp b/src/object/pushbutton.cpp index 5816607e5..5488de345 100644 --- a/src/object/pushbutton.cpp +++ b/src/object/pushbutton.cpp @@ -26,8 +26,10 @@ const std::string BUTTON_SOUND = "sounds/switch.ogg"; //14 -> 8 } -PushButton::PushButton(const Reader& lisp) - : MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), state(OFF) +PushButton::PushButton(const Reader& lisp) : + MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), + script(), + state(OFF) { sound_manager->preload(BUTTON_SOUND); set_action("off", -1); diff --git a/src/object/rainsplash.cpp b/src/object/rainsplash.cpp index 3e09eddb9..3ad899a2f 100644 --- a/src/object/rainsplash.cpp +++ b/src/object/rainsplash.cpp @@ -16,7 +16,10 @@ #include "object/rainsplash.hpp" -RainSplash::RainSplash(Vector pos, bool vertical) +RainSplash::RainSplash(Vector pos, bool vertical) : + sprite(), + position(), + frame() { frame = 0; position = pos; diff --git a/src/object/rainsplash.hpp b/src/object/rainsplash.hpp index 5baa1aa06..ad4f85ad2 100644 --- a/src/object/rainsplash.hpp +++ b/src/object/rainsplash.hpp @@ -32,6 +32,7 @@ protected: virtual void hit(Player& ); virtual void update(float time); virtual void draw(DrawingContext& context); + private: std::auto_ptr sprite; Vector position; diff --git a/src/object/rock.cpp b/src/object/rock.cpp index 382006361..ee9b2f461 100644 --- a/src/object/rock.cpp +++ b/src/object/rock.cpp @@ -38,6 +38,7 @@ Rock::Rock(const Vector& pos, std::string spritename) : Rock::Rock(const Reader& reader) : MovingSprite(reader, "images/objects/rock/rock.sprite"), + physic(), on_ground(), grabbed(), last_movement() diff --git a/src/object/scripted_object.cpp b/src/object/scripted_object.cpp index 8f1ab3639..b1a572a2e 100644 --- a/src/object/scripted_object.cpp +++ b/src/object/scripted_object.cpp @@ -22,9 +22,12 @@ #include "sprite/sprite.hpp" #include "supertux/object_factory.hpp" -ScriptedObject::ScriptedObject(const Reader& lisp) - : MovingSprite(lisp, LAYER_OBJECTS, COLGROUP_MOVING_STATIC), - solid(true), physic_enabled(true), visible(true), new_vel_set(false) +ScriptedObject::ScriptedObject(const Reader& lisp) : + MovingSprite(lisp, LAYER_OBJECTS, COLGROUP_MOVING_STATIC), + solid(true), + physic_enabled(true), + visible(true), + new_vel_set(false) { lisp.get("name", name); if(name == "") diff --git a/src/object/specialriser.cpp b/src/object/specialriser.cpp index 7c29665df..013109a8f 100644 --- a/src/object/specialriser.cpp +++ b/src/object/specialriser.cpp @@ -18,8 +18,9 @@ #include "object/specialriser.hpp" #include "supertux/sector.hpp" -SpecialRiser::SpecialRiser(Vector pos, MovingObject* _child) - : child(_child) +SpecialRiser::SpecialRiser(Vector pos, MovingObject* _child) : + offset(), + child(_child) { _child->set_pos(pos - Vector(0, 32)); offset = 0; diff --git a/src/object/specialriser.hpp b/src/object/specialriser.hpp index 76d544313..9d4237032 100644 --- a/src/object/specialriser.hpp +++ b/src/object/specialriser.hpp @@ -35,6 +35,10 @@ public: private: float offset; MovingObject* child; + +private: + SpecialRiser(const SpecialRiser&); + SpecialRiser& operator=(const SpecialRiser&); }; #endif diff --git a/src/object/sprite_particle.cpp b/src/object/sprite_particle.cpp index d8dc535e2..07d873293 100644 --- a/src/object/sprite_particle.cpp +++ b/src/object/sprite_particle.cpp @@ -23,6 +23,7 @@ SpriteParticle::SpriteParticle(std::string sprite_name, std::string action, Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration, int drawing_layer) : + sprite(), position(position), velocity(velocity), acceleration(acceleration), diff --git a/src/object/star.cpp b/src/object/star.cpp index 773be33ef..9e7932a94 100644 --- a/src/object/star.cpp +++ b/src/object/star.cpp @@ -21,8 +21,9 @@ static const float INITIALJUMP = -400; static const float SPEED = 150; static const float JUMPSPEED = -300; -Star::Star(const Vector& pos, Direction direction) - : MovingSprite(pos, "images/powerups/star/star.sprite", LAYER_OBJECTS, COLGROUP_MOVING) +Star::Star(const Vector& pos, Direction direction) : + MovingSprite(pos, "images/powerups/star/star.sprite", LAYER_OBJECTS, COLGROUP_MOVING), + physic() { physic.set_velocity((direction == LEFT) ? -SPEED : SPEED, INITIALJUMP); } diff --git a/src/object/text_object.hpp b/src/object/text_object.hpp index 0e27c264d..8ec495a6d 100644 --- a/src/object/text_object.hpp +++ b/src/object/text_object.hpp @@ -88,6 +88,10 @@ private: bool centered; AnchorPoint anchor; Vector pos; + +private: + TextObject(const TextObject&); + TextObject& operator=(const TextObject&); }; #endif diff --git a/src/object/trampoline.cpp b/src/object/trampoline.cpp index bd6c2b8bf..3b6630c39 100644 --- a/src/object/trampoline.cpp +++ b/src/object/trampoline.cpp @@ -31,12 +31,12 @@ const float VY_MIN = -900; //negative, upwards const float VY_INITIAL = -500; } -Trampoline::Trampoline(const Reader& lisp) - : Rock(lisp, "images/objects/trampoline/trampoline.sprite") +Trampoline::Trampoline(const Reader& lisp) : + Rock(lisp, "images/objects/trampoline/trampoline.sprite"), + portable(true) { sound_manager->preload(TRAMPOLINE_SOUND); - portable = true; //Check if this trampoline is not portable if(lisp.get("portable", portable)) { if(!portable) { diff --git a/src/object/unstable_tile.cpp b/src/object/unstable_tile.cpp index 015716295..de55c337b 100644 --- a/src/object/unstable_tile.cpp +++ b/src/object/unstable_tile.cpp @@ -22,8 +22,10 @@ #include "supertux/constants.hpp" #include "supertux/object_factory.hpp" -UnstableTile::UnstableTile(const Reader& lisp) - : MovingSprite(lisp, LAYER_TILES, COLGROUP_STATIC), state(STATE_NORMAL) +UnstableTile::UnstableTile(const Reader& lisp) : + MovingSprite(lisp, LAYER_TILES, COLGROUP_STATIC), + physic(), + state(STATE_NORMAL) { sprite->set_action("normal"); } diff --git a/src/physfs/physfs_stream.cpp b/src/physfs/physfs_stream.cpp index 659c8ce94..48bc10c28 100644 --- a/src/physfs/physfs_stream.cpp +++ b/src/physfs/physfs_stream.cpp @@ -22,7 +22,8 @@ #include #include -IFileStreambuf::IFileStreambuf(const std::string& filename) +IFileStreambuf::IFileStreambuf(const std::string& filename) : + file() { // check this as PHYSFS seems to be buggy and still returns a // valid pointer in this case @@ -102,7 +103,8 @@ IFileStreambuf::seekoff(off_type off, std::ios_base::seekdir dir, //--------------------------------------------------------------------------- -OFileStreambuf::OFileStreambuf(const std::string& filename) +OFileStreambuf::OFileStreambuf(const std::string& filename) : + file() { file = PHYSFS_openWrite(filename.c_str()); if(file == 0) { diff --git a/src/scripting/camera.hpp b/src/scripting/camera.hpp index 4e3d59a23..036060d91 100644 --- a/src/scripting/camera.hpp +++ b/src/scripting/camera.hpp @@ -45,6 +45,10 @@ public: #ifndef SCRIPTING_API _Camera* camera; + +private: + Camera(const Camera&); + Camera& operator=(const Camera&); #endif }; diff --git a/src/scripting/level_time.hpp b/src/scripting/level_time.hpp index 0889ecce0..aa38ee069 100644 --- a/src/scripting/level_time.hpp +++ b/src/scripting/level_time.hpp @@ -54,6 +54,10 @@ public: #ifndef SCRIPTING_API _LevelTime* level_time; + +private: + LevelTime(const LevelTime&); + LevelTime& operator=(const LevelTime&); #endif }; diff --git a/src/scripting/thunderstorm.hpp b/src/scripting/thunderstorm.hpp index 37c91c249..8548932c7 100644 --- a/src/scripting/thunderstorm.hpp +++ b/src/scripting/thunderstorm.hpp @@ -64,6 +64,10 @@ public: #ifndef SCRIPTING_API _Thunderstorm* thunderstorm; + +private: + Thunderstorm(const Thunderstorm&); + Thunderstorm& operator=(const Thunderstorm&); #endif };