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

using namespace std;

const std::string LiveCommand::_id = "live";

LiveCommand::LiveCommand(Person *person)
:_person(person->id())
{

}

LiveCommand::LiveCommand(List *command)
{
	command = command->rest();
	_person = command->firstString();
}

void LiveCommand::execute()
{
	((Person *)Level::instance()->getObject(_person))->live();
}

std::string LiveCommand::getString()
{
	List *command = new List();
	command->snoc(new Atom(_id));
	command->snoc(new Atom(_person));
	string commandString = command->getString();
	delete command;

	return commandString;
}