C:/Documents and Settings/mtauraso/Desktop/proj3/projectX/StopPersonCommand.cpp

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

Generated on Sat Apr 22 15:05:20 2006 for ProjectX by  doxygen 1.4.6-NO