- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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

Go to the documentation of this file.

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