00001 #include "Command.h" 00002 #include "Person.h" 00003 #include "Level.h" 00004 #include "List.h" 00005 #include "Player.h" 00006 00007 using namespace std; 00008 00009 const std::string EndLevelCommand::_id = "endLevel"; 00010 00011 EndLevelCommand::EndLevelCommand() 00012 { 00013 } 00014 00015 EndLevelCommand::EndLevelCommand(List *command) 00016 { 00017 } 00018 00019 void EndLevelCommand::execute() 00020 { 00021 //set the level as "won" 00022 Level::instance()->setWon(true); 00023 //kill the player so the level ends. 00024 Level::instance()->getPlayer()->die(); 00025 //Level::instance()->getPlayer()->addHealth(- Level::instance()->getPlayer()->getHealth()); 00026 } 00027 00028 std::string EndLevelCommand::getString() 00029 { 00030 List *command = new List(); 00031 command->snoc(new Atom(_id)); 00032 string commandString = command->getString(); 00033 delete command; 00034 00035 return commandString; 00036 }
1.4.6-NO