/**
 * \file State.h
 * \date 14.04.2003
 *
 * Game state
 */

#include "Player/World/State.h"
#include "Player/World/World.h"

State::State(World* w) : WorldObject(w)
{
	simTime = 0;
	playMode = PM_Null;
	ourScore = theirScore = 0;
}

State::State(const State& state) : WorldObject(state.world)
{
	simTime = state.simTime;
	playMode = state.playMode;
	ourScore = state.ourScore;
	theirScore = state.theirScore;
}

State& State::operator=(const State& state)
{
	if(&state == this) return *this;

	WorldObject::operator=(state);

	simTime = state.simTime;
	playMode = state.playMode;
	ourScore = state.ourScore;
	theirScore = state.theirScore;

	return *this;
}

bool State::IsTimeStoped() const
{
	switch(playMode)
	{
	// Play modes with stopped time
	case PM_BeforeKickOff:
	case PM_AfterGoal_Our:
	case PM_AfterGoal_Their:
		return true;
	default:
	// Other modes - time flows
		return false;
	}
}

bool State::IsOurKickIn() const
{
	switch(playMode)
	{
	case PM_KickOff_Our:
	case PM_KickIn_Our:
	case PM_FreeKick_Our:
	case PM_CornerKick_Our:
	case PM_GoalKick_Our:
	case PM_AfterGoal_Our:
	case PM_Offside_Our:
	case PM_PenaltyKick_Our:
	case PM_Foul_Charge_Our:
	case PM_Foul_Push_Our:
	case PM_Foul_MultipleAttacker_Our:
	case PM_Foul_BallOut_Our:
	case PM_GoalieCatch_Our:
	case PM_Foul_Our:
	case PM_FreeKickFault_Our:
	case PM_BackPass_Our:
	case PM_IndFreeKick_Our:
	case PM_CatchFault_Our:	
		return true;
		
	default:
		return false;
	}
}

State::~State()
{
}
