//========= Copyright © 1996-2005, Sander Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef CAPTUREPOINT_H
#define CAPTUREPOINT_H
#ifdef _WIN32
#pragma once
#endif

#include "triggers.h"
#include "hl2wars/rts_shareddefs.h"
#include "Sprite.h"

class CCapturePoint : public CTriggerMultiple
{
	DECLARE_CLASS( CCapturePoint, CTriggerMultiple );
public:
	CCapturePoint();

	void Spawn( void );
	void Precache( void );
	void UpdateOnRemove();
	void CaptureThink( void );
	//virtual void StartTouch(CBaseEntity *pOther);
	//virtual void EndTouch(CBaseEntity *pOther);
	int UpdateTeamCapturing();
	virtual int GetOwnerShip( void ) { return m_iTeamOwnership; };

	DECLARE_DATADESC();
	DECLARE_SERVERCLASS();  // make this entity networkable

	int UpdateTransmitState()	// set transmit filter to transmit always
	{
		return SetTransmitState( FL_EDICT_ALWAYS );
	}
private:
	void ChangeOwnerShip( int new_team );
	void InputChangeOwnerShip( inputdata_t &inputdata );

private:
	//CNetworkVar( int, team_ownership );
	//CNetworkVar( int, team_capturing );
	CNetworkVar( int, m_iTeamOwnership );
	CNetworkVar( int, m_iTeamCapturing );
	//int count_team_units[MAX_TEAMS_ID_RTS];

	float m_flNextAddResourceTime; 
	//float m_flNextCaptureTime;
	CNetworkVar( float, m_flNextCaptureTime );
	//CNetworkVar( float, m_flRemainingCaptureTime );		// only send the difference between curtime and next capture time.
	//CNetworkVar( float, m_flNextCaptureTime );
	//CNetworkHandle( CBaseEntity, m_hCapturePointIcon );
	string_t m_sCapturePointIcon;
	CNetworkVector( m_vIconTarget );

	COutputEvent m_OnCapturedAll;
	COutputEvent m_OnCaptured[MAX_TEAMS_ID_RTS];
	COutputEvent m_OnLost[MAX_TEAMS_ID_RTS];

	EHANDLE m_hSprite;
};

#endif // CAPTUREPOINT_H