//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//
//=============================================================================//
#ifndef LOGICVICTORYCOND_H
#define LOGICVICTORYCOND_H

#include "cbase.h"
#include "hl2wars/rts_shareddefs.h"
//#include "entityinput.h"
//#include "entityoutput.h"
//#include "eventqueue.h"

enum VictoryConditions_t
{
	VCOND_CUSTOM,
	VCOND_OBJS_COMPLETED,
	VCON_ALLCP_CAPTURED,
};

enum FailureConditions_t
{
	FCOND_CUSTOM,
	FCOND_UNITS_DEAD,
	FCOND_NO_CAPTUREPOINTS,
	FCOND_BASE_DEAD,
	FCOND_UNITS_AND_BASE_DEAD,
};

class CLogicVictoryConditions : public CLogicalEntity
{
public:
	DECLARE_CLASS( CLogicVictoryConditions, CLogicalEntity );

	CLogicVictoryConditions();

	//void OnThink( void );
	void Activate();
	void Think();
	void CheckUnitCount( void );
	void CheckCapturePoints( void );
	void CheckCapturePointsWin( void );
	void CheckBaseCount();
	void CheckBaseAndUnitCount();

	void Victory( int teamid );
	void Failure( int teamid );

	// Input handlers
	void InputEnable( inputdata_t &inputdata );
	void InputDisable( inputdata_t &inputdata );
	void InputToggle( inputdata_t &inputdata );

	void InputChangeVictoryCond( inputdata_t &inputdata );
	void InputChangeFailureCond( inputdata_t &inputdata );

	DECLARE_DATADESC();

	// Outputs
	COutputEvent m_OnSpawn;

	// fail/victory outputs
	// declaring this in an array seems to cause trouble when saving, loading and saving again :s
	//COutputEvent m_OnVictory[MAX_TEAMS_ID_RTS];
	COutputEvent m_OnVictory3;
	COutputEvent m_OnVictory4;
	COutputEvent m_OnVictory5;
	COutputEvent m_OnVictory6;
	COutputEvent m_OnVictory7;
	COutputEvent m_OnVictory8;
	COutputEvent m_OnVictory9;
	COutputEvent m_OnVictory10;
	//COutputEvent m_OnFailure[MAX_TEAMS_ID_RTS];
	COutputEvent m_OnFailure3;
	COutputEvent m_OnFailure4;
	COutputEvent m_OnFailure5;
	COutputEvent m_OnFailure6;
	COutputEvent m_OnFailure7;
	COutputEvent m_OnFailure8;
	COutputEvent m_OnFailure9;
	COutputEvent m_OnFailure10;
	
private:
	bool m_bDisabled;

	int m_VictoryCondition;
	int m_FailureCondition;

	bool m_bVictory[MAX_TEAMS_ID_RTS];
	bool m_bFailure[MAX_TEAMS_ID_RTS];
};

#endif //LOGICVICTORYCOND_H