
#pragma once

#include "mw4.hpp"
#include "adept\map.hpp"
#include "ai.hpp"

namespace ElementRenderer {class GridElement;}

namespace Adept {

	class Map;

	//##########################################################################
	//###########################    MWMap    ##################################
	//##########################################################################

	class MWMap: public Map
	{

	public:
		static void InitializeClass();
		static void	TerminateClass();
		static ClassData *DefaultData;

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

	protected:
		MWMap(ClassData *class_data,const CreateMessage *message,ReplicatorID *base_id,ElementRenderer::GridElement *element);
		~MWMap();

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Ownership 
	//
	public:
		void AddChild(Entity *entity);
		void RemoveChild(Entity *entity);
		ChainOf<AI *> m_executingAIs;

	protected:

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Execution support
	//
	public:
		void PreCollisionExecute(Stuff::Time till);

	};
}
