#pragma once

#include "MW4.hpp"
#include "Vehicle.hpp"

namespace MechWarrior4
{

	//##########################################################################
	//###########################   Team    ################################
	//##########################################################################

	typedef Vehicle__ClassData					Team__ClassData;
	typedef Vehicle__Message					Team__Message;
	typedef Vehicle__CreateMessage				Team__CreateMessage;
	typedef Vehicle__GameModel					Team__GameModel;
	typedef Vehicle__ExecutionStateEngine		Team__ExecutionStateEngine;
	

	class Team : public Vehicle
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Inheritance support
	//
	public:
		typedef Team__ClassData							ClassData;
		typedef Team__GameModel							GameModel;
		typedef Team__Message								Message;
		typedef Team__ExecutionStateEngine	ExecutionStateEngine;
		typedef Team__CreateMessage					CreateMessage;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Static Methods
	//
	public:
		static void InitializeClass();
		static void TerminateClass();

		typedef Vehicle BaseClass;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Run-time Construction and Destruction Support
	//
	public:
		static Team* Make(CreateMessage *message,ReplicatorID *base_id);

	protected:
		Team(ClassData *class_data,CreateMessage *message,ReplicatorID *base_id,ElementRenderer::Element *element);

		~Team();

		void Reuse(const CreateMessage *message,ReplicatorID *base_id);



	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Shared Data support
	//
	public:
		static ClassData *DefaultData;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Simulation Support
	//
	protected:
	

		void TurnOn(void);
	public:
		

		int GetTableArray()
				{Check_Object(this); return NameTable::TeamArray;}


		int m_teamAlignment;
		char m_teamPrefix;

		ObjectID m_MostRecentTeamNav;

		void SetTeamAlignment(int alignment)
		{
			m_teamAlignment = alignment;
		}

		int GetTeamAlignment()
		{
			return m_teamAlignment;
		}

		void SetTeamPrefix(char prefix)
		{
			m_teamPrefix = prefix;
		}

		char GetTeamPrefix()
		{
			return m_teamPrefix;
		}


		ChainOf<Vehicle*>
			membersOfTeam;

		void AddMemberToTeam(Vehicle *member)
		{
			membersOfTeam.Add(member);
		}

		void RemoveMemberFromTeam(Vehicle* member)
		{
			membersOfTeam.Remove(member);
		}

		bool IsEmpty()
		{
			return (membersOfTeam.IsEmpty());
		}

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Test Support
	//
	public:
		void TestInstance() const;
	};
}


