- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/Documents and Settings/jegan/Desktop/projectX/JumpResetCommand.cpp

Go to the documentation of this file.

    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->id())
    00013 {
    00014 }
    00015
    00016 JumpResetCommand::JumpResetCommand(List *command)
    00017 {
    00018         command = command->rest();
    00019         _person = command->firstString();
    00020 }
    00021
    00022 void JumpResetCommand::execute()
    00023 {
    00024         Person *person = (Person *)Level::instance()->getObject(_person);
    00025         if(person == NULL)
    00026                 return;
    00027
    00028         person->jumpReset();
    00029 }
    00030
    00031 std::string JumpResetCommand::getString()
    00032 {
    00033         List *command = new List();
    00034         command->snoc(new Atom(_id));
    00035         command->snoc(new Atom(_person));
    00036         string commandString = command->getString();
    00037         delete command;
    00038
    00039         return commandString;
    00040 }