#include "C:\L\Campaign\Campaign.h"
Campaign::Campaign()
{
	Reset();
}
Campaign::~Campaign()
{
	if(MapList.isEmpty() == false)
		while(MapList.isEmpty() == false) MapList.popFront();
}
void Campaign::Reset()
{
	//Default is -1 because numbers zero and above are legitimate values
	CampaignID				= -1;
	AvatarID				= -1;
	CamppaignNickName		= "";
}
const Campaign& Campaign::operator=(const Campaign &other)
{
	string tmp;
	int i;
	if(this != &other)
	{
		CampaignID			= other.CampaignID;
		AvatarID			= other.AvatarID;
		CamppaignNickName	= other.CamppaignNickName;
		i = 0;
		while(i < int(other.MapList.length()))
		{
			other.MapList.getNodes(i, tmp);
			MapList.insertBack(tmp);
			i++;
		}
	}//end: if(this != &other)
	return *this;
}
const Campaign* Campaign::operator=(const Campaign *other)
{
	string tmp;
	int i;
	if(this != other)
	{
		CampaignID			= other->CampaignID;
		AvatarID			= other->AvatarID;
		CamppaignNickName	= other->CamppaignNickName;
		i = 0;
		while(i < int(other->MapList.length()))
		{
			other->MapList.getNodes(i, tmp);
			MapList.insertBack(tmp);
			i++;
		}
	}
	return this;
}
void Campaign::SetCampaignID(int Data)
{
	//Allow negative numbers in case we want calling
	//software to set to and invalid value
	if(Data >= 0) CampaignID = Data;
	else			MessageBox(NULL, "SetCampaignID() input bad", "Okay", MB_OK);
}
int Campaign::GetCampaignID() const
{
	return CampaignID;
}
void Campaign::SetAvatarID(int Data)
{
	if(Data >= 0) AvatarID = Data;
	else			MessageBox(NULL, "SetAvatarID() input bad", "Okay", MB_OK);
}
int Campaign::GetAvatarID() const
{
	return AvatarID;
}
void Campaign::SetNickName(string Nick)
{
	string tmp;
	tmp = Nick;
	if(int(tmp.length()) > 0)
	{
		for(int i = 0; i < int(tmp.length()); i++)
			if(tmp[i] == ' ') tmp[i] = '_';
		CamppaignNickName = tmp;
	}
	else CamppaignNickName = "Assiagn_Name";
}
string Campaign::GetNickName() const
{
	if(int(CamppaignNickName.length() > 0))	return CamppaignNickName;
	else									return "Pick_NickName";
}
bool Campaign::AddMapVisited(string mapName)
{
	int i;
	string tmp, test;
	tmp = mapName;
	if(int(tmp.length()) > 0)
	{
		//Make sure that the map name is cleaned up...
		for(i = 0; i < int(tmp.length()); i++) if(tmp[i] == ' ') tmp[i] = '_';
		//Check to see if the name matches previous names...
		for(i = 0; i < MapList.length(); i++)
		{
			MapList.getNodes(i, test);
			//Been here before, don't need to add it...
			if(test == tmp) return false;
		}
	}
	//Bad data...return without doing anything
	else return false;

	MapList.insertBack(tmp);
	return true;
}
string Campaign::GetData(int index)
{
	string tmp = "";
	if(int(MapList.length()) > 0)
	{
		MapList.getNodes(index, tmp);
	}
	else tmp = "Empty";
	return tmp;
}