#include "Command.h"
#include "Level.h"
#include "List.h"

#include <sstream>

using namespace std;

const std::string CutSceneTextCommand::_id = "cutSceneText";

CutSceneTextCommand::CutSceneTextCommand(std::string text)
:_text(text)
{

}

CutSceneTextCommand::CutSceneTextCommand(List *command)
{
	command = command->rest();
	_text = command->firstString();
}

void CutSceneTextCommand::execute()
{
	Level::instance()->setCutSceneText(_text);
}

std::string CutSceneTextCommand::getString()
{
	List *command = new List();
	command->snoc(new Atom(_id));

	stringstream str;
	str << '"' << _text << '"';
	command->snoc(new Atom(str.str()));
	string commandString = command->getString();
	delete command;

	return commandString;
}