
/*!
* @file HavePosition.cpp
* @brief シンボル保持抽象クラスを定義する
* @date 2014/06/11
* @author Deskull
* 2014 Sikabane Works.
*/

#include "stdafx.h"
#include "HavePosition.h"

namespace Deeangband
{
	HavePosition::HavePosition(void)
	{
		WipeData();
		return;
	}

	HavePosition::~HavePosition(void)
	{
		WipeData();
		return;
	}

	HavePosition::HavePosition(MAP_LENGTH x, MAP_LENGTH y)
	{
		WipeData();
		this->position.Set(x, y);
		return;
	}

	HavePosition::HavePosition(std::map<ID, std::shared_ptr<Field>>::iterator fieldIt, MAP_LENGTH x, MAP_LENGTH y)
	{
		this->position.Set(x, y);
		this->fieldID = fieldIt->first;
		this->fieldPtr =  fieldIt->second;
		return;
	}

	void HavePosition::WipeData(void)
	{
		this->position.Set(0, 0);
		this->fieldID = 0;
		this->fieldPtr = NULL;
	}

	Coordinates HavePosition::GetPosition(void)
	{
		return this->position;
	}

	ID HavePosition::GetFieldID(void)
	{
		return this->fieldID;
	}

	ACTION_RESULT HavePosition::Move(ID fieldID, MAP_POSITION x, MAP_POSITION y)
	{
		this->fieldID = fieldID;
		this->position.Set(x, y);
		return AR_SUCCESS;
	}

	ACTION_RESULT HavePosition::Move(ID fieldID, Coordinates coord)
	{
		return this->Move(fieldID, coord.GetX(), coord.GetY());
	}

}
