From: Ingo Ruhnke Date: Sun, 17 Aug 2014 01:46:23 +0000 (+0200) Subject: Moved Block code to block.cpp, was in the wrong file, i.e. bonus_block.cpp X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8c15e7ca0e6338f60c0de6873e9178f7ae57ab74;p=supertux.git Moved Block code to block.cpp, was in the wrong file, i.e. bonus_block.cpp --- diff --git a/src/object/block.cpp b/src/object/block.cpp index 1f05d7918..dd1272f6b 100644 --- a/src/object/block.cpp +++ b/src/object/block.cpp @@ -18,12 +18,14 @@ #include "audio/sound_manager.hpp" #include "badguy/badguy.hpp" +#include "object/broken_brick.hpp" #include "object/coin.hpp" #include "object/flower.hpp" #include "object/growup.hpp" #include "object/player.hpp" #include "object/portable.hpp" #include "supertux/constants.hpp" +#include "supertux/sector.hpp" static const float BOUNCY_BRICK_MAX_OFFSET = 8; static const float BOUNCY_BRICK_SPEED = 90; @@ -145,4 +147,22 @@ Block::start_break(GameObject* hitter) breaking = true; } +void +Block::break_me() +{ + Sector* sector = Sector::current(); + sector->add_object( + new BrokenBrick(sprite->clone(), get_pos(), Vector(-100, -400))); + sector->add_object( + new BrokenBrick(sprite->clone(), get_pos() + Vector(0, 16), + Vector(-150, -300))); + sector->add_object( + new BrokenBrick(sprite->clone(), get_pos() + Vector(16, 0), + Vector(100, -400))); + sector->add_object( + new BrokenBrick(sprite->clone(), get_pos() + Vector(16, 16), + Vector(150, -300))); + remove_me(); +} + /* EOF */ diff --git a/src/object/bonus_block.cpp b/src/object/bonus_block.cpp index c2d04c674..044f4705b 100644 --- a/src/object/bonus_block.cpp +++ b/src/object/bonus_block.cpp @@ -19,7 +19,6 @@ #include "audio/sound_manager.hpp" #include "badguy/badguy.hpp" #include "lisp/list_iterator.hpp" -#include "object/broken_brick.hpp" #include "object/flower.hpp" #include "object/bouncy_coin.hpp" #include "object/coin_explode.hpp" @@ -451,24 +450,6 @@ BonusBlock::try_drop(Player *player) } void -Block::break_me() -{ - Sector* sector = Sector::current(); - sector->add_object( - new BrokenBrick(sprite->clone(), get_pos(), Vector(-100, -400))); - sector->add_object( - new BrokenBrick(sprite->clone(), get_pos() + Vector(0, 16), - Vector(-150, -300))); - sector->add_object( - new BrokenBrick(sprite->clone(), get_pos() + Vector(16, 0), - Vector(100, -400))); - sector->add_object( - new BrokenBrick(sprite->clone(), get_pos() + Vector(16, 16), - Vector(150, -300))); - remove_me(); -} - -void BonusBlock::draw(DrawingContext& context){ // do the regular drawing first Block::draw(context);