00001 #include "Command.h" 00002 #include "Level.h" 00003 #include "List.h" 00004 00005 #include <sstream> 00006 00007 using namespace std; 00008 00009 const std::string CutSceneTextCommand::_id = "cutSceneText"; 00010 00011 CutSceneTextCommand::CutSceneTextCommand(std::string text) 00012 :_text(text) 00013 { 00014 00015 } 00016 00017 CutSceneTextCommand::CutSceneTextCommand(List *command) 00018 { 00019 command = command->rest(); 00020 _text = command->firstString(); 00021 } 00022 00023 void CutSceneTextCommand::execute() 00024 { 00025 Level::instance()->setCutSceneText(_text); 00026 } 00027 00028 std::string CutSceneTextCommand::getString() 00029 { 00030 List *command = new List(); 00031 command->snoc(new Atom(_id)); 00032 00033 stringstream str; 00034 str << '"' << _text << '"'; 00035 command->snoc(new Atom(str.str())); 00036 string commandString = command->getString(); 00037 delete command; 00038 00039 return commandString; 00040 }