#ifndef BOT_DB_H
#define BOT_DB_H

#define DB_SPOT_VERSION 1.0f
#define MAX_CUSTOM_DB_GATHER_SPOTS 10
#define DBSPOT_HEIGHTOFFSET		50

struct db_file_header_s
{
	float flVersion;
	char szMapName[32];
};

struct db_spot_s
{
	Vector origin;
	bool Deleted;

	db_spot_s(void) : origin(g_vecZero), Deleted(true) {};
};

class CBot;

class CBotDBManager
{
	bool m_bDrawDBSpots;
	float m_fLastDBSpotDrawTime;
	bool m_bAssignDBSpots;
	bool m_bCheckedForValidDBs;
	bool m_bCanPlayCPTDB;

	struct bot_role_info_s
	{
		short sDefenders;
		short sCollecters;
		short sAttackers;

		bot_role_info_s(void) : sDefenders(0), sCollecters(0), sAttackers(0) {};
	} m_TeamGoodBotDBRoleInfo, m_TeamEvilBotDBRoleInfo;

public:
	// constructor
	CBotDBManager(void);
	// destructor
	~CBotDBManager(void) {};

	void Think(void);
	void AssignBotRole(CBot *pBot);
	void FinishWish(void) { m_bAssignDBSpots = true; };
	bool CanPlayCPTDB(void);

	// Custom gather spot stuff
	void AssignDBGatherSpots(void);
	short GetRandomDBSpotIndex(short Team);
	void LoadCustomGatherDBSpots(void);
	void SaveCustomGatherDBSpots(void);
	void PlaceNewDBGatherSpot(void);
	void DeleteDBGatherSpot(void);
	void DrawDBGatherSpots(void);
	db_spot_s *GetNearestDBSpotIndex(CBasePlayer *pPlayer, float flRadius);
	void DrawDBSpots(bool Visible) { m_bDrawDBSpots = Visible; };
	void ClearAllDBSpots(void);
	void BotDisconnect(CBot *pBot);
};
	
#endif // BOT_DB_H