#include "MW4Headers.hpp"

#include "mw4.hpp"
#include <Adept\Resource.hpp>
#include <Stuff\NotationFile.hpp>
#include "abl.h"
#include "AI_Groups.hpp"
#include "dropship.hpp"
#include "moverai.hpp"
namespace ABL
{
	extern TypePtr      IntegerTypePtr;
}

namespace MW4AI
{
	bool BoardDropShip (stlport::vector<MoverAI *>& GroupList,Dropship *drop)
	{
		stlport::vector<MoverAI *>::iterator groupiter,iter;
		bool done = true;

		for (groupiter = GroupList.begin ();groupiter != GroupList.end ();groupiter++)
		{
			Check_Object ((*groupiter));
			if ((*groupiter)->DropState () != MoverAI::DROP_DONE)
				done = false;
		}
		if (done)
			return true;

		done = true;
		for (groupiter = GroupList.begin ();groupiter != GroupList.end ();groupiter++)
		{
			if ((*groupiter)->DropState () == MoverAI::DROP_NOT_ACTIVE)
				done = false;
		}
		if (!done)			// start up dropship board
		{
			int id;
			for (id=0,groupiter = GroupList.begin ();groupiter != GroupList.end ();groupiter++,id++)
			{
				int count;
				for (count=0,iter = GroupList.begin ();iter != GroupList.end ();iter++,count++)
					(*groupiter)->AddDropshipBoarder (count,(*iter));
				(*groupiter)->CreateDropShipPoints (id,drop);
				(*groupiter)->PrepareBoardDropShip ();
			}
		}
		return false;
	}

}

