C:/Documents and Settings/mtauraso/Desktop/proj3/projectX/SetControlCommand.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 "Object.h"
00006 
00007 using namespace std;
00008 
00009 const std::string SetControlCommand::_id = "setControl";
00010 
00011 SetControlCommand::SetControlCommand(Object *object)
00012 :_object(object)
00013 {
00014 
00015 }
00016 
00017 SetControlCommand::SetControlCommand(List *command)
00018 {
00019         command = command->rest();
00020         _object = Level::instance()->getObject(command->firstString());
00021 }
00022 
00023 void SetControlCommand::execute()
00024 {
00025         Control::detachAllControllers();
00026         Control::registerController(_object);
00027 }
00028 
00029 std::string SetControlCommand::getString()
00030 {
00031         List *command = new List();
00032         command->snoc(new Atom(_id));
00033         command->snoc(new Atom(_object->id()));
00034         string commandString = command->getString();
00035         delete command;
00036 
00037         return commandString;
00038 }

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