/**
 * \file SquareZoneStatistic.cpp
 * \date 06.03.2005
 * \author Marian Tines
 *
 * Implementation of the SquareZoneStatistics class
 */

#include "Coach/SquareZoneStatistic.h"
#include <iostream>

using namespace std;

// Serialization of the class
void SquareZoneStatistic::SerializeYourself(std::ofstream &fs)
{
	fs << friendPlayerInTheZone << " " << enemyPlayerInTheZone << " " << ballInTheZone << endl;
}

//  Deserialization of the class
void SquareZoneStatistic::DeserialileYourself(std::ifstream &fs)
{
	fs >> friendPlayerInTheZone >> enemyPlayerInTheZone >> ballInTheZone;
}

unsigned int SquareZoneStatistic::GetInTheZone(StatisticsType type) const
{
	switch (type)
	{
		case FRIEND:
			return GetFriendPlayerInTheZone();

		case ENEMY:
			return GetEnemyPlayerInTheZone();

		case BALL:
			return GetBallInTheZone();

		default:
			return 0;
	}
}

// Resets the statistics
void SquareZoneStatistic::Reset()
{
	friendPlayerInTheZone = 0;
	enemyPlayerInTheZone = 0;
	ballInTheZone = 0;
}

