#ifndef RTS_BUILDINGS_H
#define RTS_BUILDINGS_H

// ##################################################################################
//	>>
//
// ##################################################################################

#include "hl2wars/c_rts_mouse_brush.h"
#include "hl2wars/c_rts_basebuilding.h"
#include "hl2wars/rts_shareddefs.h"

class C_LocalTempEntity;

class C_BuildingBrush : public C_MouseRTSBrush 
{
public:
	DECLARE_CLASS( C_BuildingBrush , C_MouseRTSBrush );
	DECLARE_CLIENTCLASS();

	// Constructor
	C_BuildingBrush ( void );
	~C_BuildingBrush ( void );

	virtual void	OnCursorEntered();

	int				GetOwnerShip() { return m_iOwnerShip; }
	float			GetBuildTime() { return m_fBuildTime; }
	float			GetBuildTimeMax() { return m_fBuildTimeMax; }
	Vector			GetOwnerShipTarget() { return m_vOwnerShipIconTarget; }
	int				GetUnitIndex( int i ) { return m_iTypesQueue[i]; }
	int				GetUnitIndexBuild( int i ) { return m_iTypesAbilities[i - 1]; }
	int				GetUnitCount( int i ) { return m_iQueueAmount[i]; }
	const char			*GetUnitType( int unit_index );

	void Spawn();
	void			OnDataChanged( DataUpdateType_t type );
	void			UpdateOnRemove();
	virtual void	OnRestore();

	virtual void	SetSelected( bool selected );
	virtual bool	IsSelected() { return m_bSelected; }

	virtual color32 GetColor();

	virtual int GetBrushType( void ) { return MOUSEBRUSH_BUILDING; }

private:
	int				m_iOwnerShip;
	Vector			m_vOwnerShipIconTarget;
	bool			m_bSelected;

	// build info
	float			m_fBuildTime;
	int				m_iTypesQueue[QUEUE_MAX];
	int				m_iQueueAmount[QUEUE_MAX];
	float			m_fBuildTimeMax;
	int				m_iTypesAbilities[MAXABILITIESSLOTS];

private:
	Vector			m_vRallyPoint;
	C_LocalTempEntity	*m_pRallyPoint;

public:
	C_BuildingBrush			*m_pNext;
};

extern C_BuildingBrush *GetBuildingBrushList();

// ##################################################################################
//	>> Building model implementation
//
// ##################################################################################
class C_BuildingModel : public C_BaseBuildingModel
{
public:
	DECLARE_CLASS( C_BuildingModel , C_BaseBuildingModel );
	DECLARE_CLIENTCLASS();

	C_BuildingModel();

	void			UpdateOnRemove();

	virtual void	OnRestore();

	virtual void	SetSelected( bool selected );

	float			GetBuildTime() { return m_fBuildTime; }
	float			GetBuildTimeMax() { return m_fBuildTimeMax; }
	int				GetTypeQueueAbility( int i ) { return m_iTypesQueue[i]; }
	int				GetTypeAbility( int i ) { return m_iTypesAbilities[i - 1]; }
	int				GetQueueCount( int i ) { return m_iQueueAmount[i]; }

	void			Spawn();
	void			OnDataChanged( DataUpdateType_t type );

private:
	// build info
	float			m_fBuildTime;
	int				m_iTypesQueue[QUEUE_MAX];
	int				m_iQueueAmount[QUEUE_MAX];
	float			m_fBuildTimeMax;
	int				m_iTypesAbilities[MAXABILITIESSLOTS];

private:
	Vector			m_vRallyPoint;
	C_LocalTempEntity	*m_pRallyPoint;
};

#endif  // RTS_BUILDINGS_H