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


using namespace std;

const std::string JumpResetCommand::_id = "jumpReset";

JumpResetCommand::JumpResetCommand(Person *person)
:_person(person->id())
{
}

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

void JumpResetCommand::execute()
{
	Person *person = (Person *)Level::instance()->getObject(_person);
	if(person == NULL)
		return;

	person->jumpReset();
}

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

	return commandString;
}