From: Christoph Sommer Date: Sat, 20 Jan 2007 00:48:21 +0000 (+0000) Subject: Issue #89: Respawn Tux at original, not current position. This is because upon restar... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6f03ad6816c77e5ae167427be4217cc8dd1df78d;p=supertux.git Issue #89: Respawn Tux at original, not current position. This is because upon restart, the reset of the level objects will be at their original position, too. SVN-Revision: 4608 --- diff --git a/src/object/firefly.cpp b/src/object/firefly.cpp index ed10daeae..dc537cc2c 100644 --- a/src/object/firefly.cpp +++ b/src/object/firefly.cpp @@ -33,6 +33,7 @@ Firefly::Firefly(const lisp::Lisp& lisp) : MovingSprite(lisp, "images/objects/resetpoints/default-resetpoint.sprite", LAYER_TILES, COLGROUP_TOUCHABLE), activated(false) { + initial_position = get_pos(); if( !lisp.get( "sprite", sprite_name ) ){ reactivate(); return; @@ -51,7 +52,7 @@ Firefly::Firefly(const lisp::Lisp& lisp) void Firefly::reactivate() { - if(GameSession::current()->get_reset_point_pos() == get_pos()){ + if(GameSession::current()->get_reset_point_pos() == initial_position){ // TODO: && GameSession::current()->get_reset_point_sectorname() == // GameSession::current()->get_current_sector()->get_name() is not yet initialized. // Worst case a resetpoint in a different sector at the same position as the real @@ -94,7 +95,7 @@ Firefly::collision(GameObject& other, const CollisionHit& ) // TODO play sound sprite->set_action("ringing"); GameSession::current()->set_reset_point(Sector::current()->get_name(), - get_pos()); + initial_position); } return ABORT_MOVE; diff --git a/src/object/firefly.hpp b/src/object/firefly.hpp index 889afe3bd..632508794 100644 --- a/src/object/firefly.hpp +++ b/src/object/firefly.hpp @@ -40,6 +40,7 @@ public: private: bool activated; + Vector initial_position; /**< position as in level file. This is where Tux will have to respawn, as the level is reset every time */ void reactivate(); };