00001 #include "Command.h" 00002 #include "Person.h" 00003 #include "Level.h" 00004 #include "List.h" 00005 00006 00007 using namespace std; 00008 00009 const std::string JumpResetCommand::_id = "jumpReset"; 00010 00011 JumpResetCommand::JumpResetCommand(Person *person) 00012 :_person(person) 00013 { 00014 } 00015 00016 JumpResetCommand::JumpResetCommand(List *command) 00017 { 00018 command = command->rest(); 00019 _person = (Person *)Level::instance()->getObject(command->firstString()); 00020 } 00021 00022 void JumpResetCommand::execute() 00023 { 00024 _person->jumpReset(); 00025 } 00026 00027 std::string JumpResetCommand::getString() 00028 { 00029 List *command = new List(); 00030 command->snoc(new Atom(_id)); 00031 command->snoc(new Atom(_person->id())); 00032 string commandString = command->getString(); 00033 delete command; 00034 00035 return commandString; 00036 }