Fixed compiler warning about missing return
[supertux.git] / src / trigger / door.cpp
index 56060d4..3ee067c 100644 (file)
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+#include "trigger/door.hpp"
+
+#include <sstream>
+
 #include "audio/sound_manager.hpp"
 #include "object/player.hpp"
 #include "sprite/sprite_manager.hpp"
 #include "supertux/game_session.hpp"
 #include "supertux/object_factory.hpp"
 #include "supertux/sector.hpp"
-#include "trigger/door.hpp"
 #include "util/reader.hpp"
 
 Door::Door(const Reader& reader) :
   state(CLOSED),
   target_sector(),
   target_spawnpoint(),
+  script(),
   sprite(),
   stay_open_timer()
 {
@@ -48,6 +52,7 @@ Door::Door(int x, int y, std::string sector, std::string spawnpoint) :
   state(CLOSED),
   target_sector(),
   target_spawnpoint(),
+  script(),
   sprite(),
   stay_open_timer()
 {
@@ -139,12 +144,12 @@ Door::collision(GameObject& other, const CollisionHit& hit)
       if (player) {
         state = CLOSING;
         sprite->set_action("closing", 1);
-        if(script != "") {
+        if(!script.empty()) {
           std::istringstream stream(script);
           Sector::current()->run_script(stream, "Door");
         }
 
-        if(target_sector != "") {
+        if(!target_sector.empty()) {
           GameSession::current()->respawn(target_sector, target_spawnpoint);
         }
       }