//Copyright (C) 2007 SiegeLord
//See ReadMe.txt and License.txt for copying information

#pragma once

#include "neonz.h"

enum EOrderTypes
{
	no_order,
	idle_order,
	move_order,
	stop_order,
	die_order,
	attack_order
};

struct SShip;

void HandleOrders(std::list<SShip*> *selected_ships);

struct SOrder
{
	SOrder()
	{
		order_type = no_order;
	}

	int order_type;

	virtual ~SOrder() {};
	//returns true if the order is completed
	virtual bool Handle() {return true;};

	SShip* ship;
};

struct SIdleOrder : SOrder
{
	SIdleOrder()
	{
		order_type = idle_order;
	}
	virtual ~SIdleOrder() {};
	virtual bool Handle();
};

//this just stops the ship
struct SStopOrder : SOrder
{
	SStopOrder()
	{
		order_type = stop_order;
		timer = 0;
		time_to_stop = 0;
	}
	float timer;
	float time_to_stop;
	virtual ~SStopOrder() {};
	virtual bool Handle();
};

struct SMoveOrder : SOrder
{
	SMoveOrder()
	{
		order_type = move_order;
	}
	SMoveOrder(vector2d& dest);
	virtual ~SMoveOrder() {};
	virtual bool Handle();

	vector2d destination;
};

struct SDieOrder : SOrder
{
	SDieOrder()
	{
		order_type = die_order;
	}
	SDieOrder(vector2d& dest);
	virtual ~SDieOrder() {};
	virtual bool Handle();

	float delay;
};

struct SAttackOrder : SOrder
{
	SAttackOrder()
	{
		order_type = attack_order;
		moving = false;
	}
	SAttackOrder(vector2d& dest);
	virtual ~SAttackOrder() {};
	virtual bool Handle();

	bool moving;

	//where are we moving to get in range
	vector2d move_dest;

	vector2d target_loc;
	int target_ship_id;
};
