#ifndef __AIKNOWHPP__
#define __AIKNOWHPP__

enum KNOWLEDGE_LEVEL {KNOW_BEARING,KNOW_BEARINGSPEED,KNOW_LOCATION,KNOW_TRUE};
enum THREAT_LEVEL {IMMEDIATE_THREAT,POTENTIAL_THREAT,WARNING_THREAT,OPPORTUNITY_THREAT};

typedef union {
	struct {
		double bearingOffset;
	};
	struct {
		double temp;
	};
} AICalcData;

class AIKnowledge 
{
private:
	static FixedHeap<AIKnowledge> m_EmptyKnowledge;

protected:
	int id;
	double distance;
	double bearing;
	double curX,curY;
	double speed;
	KNOWLEDGE_LEVEL knowledge;
	THREAT_LEVEL threat;
	UINT subthreat;

	int validCount;
	AIKnowledge *next,*prev;

	AIKnowledge *tnext,*tprev;
	AICalcData calcData;

public:
	AIKnowledge (void);
	~AIKnowledge (void);

    static AIKnowledge *GetBlankKnowledge (void) { return (AIKnowledge *) m_EmptyKnowledge.Alloc (); }
    static void DoneKnowledge (AIKnowledge *oldknow)  { m_EmptyKnowledge.Free (oldknow); }

	void *operator new (size_t size) {return GetBlankKnowledge (); } 
	void operator delete (void *value,size_t size) { DoneKnowledge ((AIKnowledge *) value); }
};

#endif