From: LMH Date: Fri, 23 Nov 2012 12:18:16 +0000 (-1000) Subject: Multi-coin bonus block (not bricks) handeled correctly in level stats X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ae73da5af85fe1c44c8db0eb84a2c131f885dce1;p=supertux.git Multi-coin bonus block (not bricks) handeled correctly in level stats --- diff --git a/data/levels/test/bonusblock.stl b/data/levels/test/bonusblock.stl index 8fe206c79..44cf5f07d 100755 --- a/data/levels/test/bonusblock.stl +++ b/data/levels/test/bonusblock.stl @@ -37,8 +37,8 @@ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; 608 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; 640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; 672 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; 704 -8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ; 736 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 132 0 ; 704 +8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 48 8 ; 736 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 ; 768 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ; 800 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ; 832 diff --git a/src/object/bonus_block.cpp b/src/object/bonus_block.cpp index c0322e79f..3a2596f14 100644 --- a/src/object/bonus_block.cpp +++ b/src/object/bonus_block.cpp @@ -182,7 +182,8 @@ BonusBlock::try_open(Player *player) { Sector::current()->add_object(new BouncyCoin(get_pos(), true)); player->get_status()->add_coins(1); - Sector::current()->get_level()->stats.coins++; + if (hit_counter != 0) + Sector::current()->get_level()->stats.coins++; break; } diff --git a/src/object/bonus_block.hpp b/src/object/bonus_block.hpp index fd248f165..d8798b381 100644 --- a/src/object/bonus_block.hpp +++ b/src/object/bonus_block.hpp @@ -45,11 +45,11 @@ protected: public: Contents contents; MovingObject* object; + int hit_counter; private: BonusBlock(const BonusBlock&); BonusBlock& operator=(const BonusBlock&); - int hit_counter; std::string sprite_name; std::string script; }; diff --git a/src/supertux/level.cpp b/src/supertux/level.cpp index e9d6e085b..3b70d653f 100644 --- a/src/supertux/level.cpp +++ b/src/supertux/level.cpp @@ -201,7 +201,7 @@ Level::get_total_coins() { if (block->contents == BonusBlock::CONTENT_COIN) { - total_coins++; + total_coins += block->hit_counter; continue; } #if 0