#pragma once #ifndef __MOVERECTHPP__ #define __MOVERECTHPP__ #pragma warning (push) #include #pragma warning (pop) namespace MW4AI { struct OBRect { Scalar left,right,top,bottom; int building; bool vertical; // true if this rect is passable vertically OBRect (Scalar p1,Scalar p2,Scalar p3,Scalar p4,int p5,bool p6) { left = p1; top = p2; right = p3; bottom = p4; building = p5; vertical = p6; } OBRect (void) { left = right = top = bottom = 0; building = -1; vertical = false; } Point3D TopPoint (void) const { return Point3D (((right-left)/2.0f)+left,0.0f,top-BLOCK_GRID_RES); } Point3D BottomPoint (void) const { return Point3D (((right-left)/2.0f)+left,0.0f,bottom+BLOCK_GRID_RES); } Point3D LeftPoint (void) const { return Point3D (left-BLOCK_GRID_RES,0.0f,((bottom-top)/2.0f)+top); } Point3D RightPoint (void) const { return Point3D (right+BLOCK_GRID_RES,0.0f,((bottom-top)/2.0f)+top); } }; class CMoveRectList { private: stlport::vector m_Rects; void AddBuildingData (void); void DumpFile (void); public: CMoveRectList (Stuff::MemoryStream *stream); CMoveRectList (void); ~CMoveRectList (void); bool RectWithin (Stuff::Point3D& pt,Stuff::Scalar dist); void Create (WorkCallBack callback); void SaveFile (const char *filename); static void ConstructStream (Stuff::MemoryStream *stream,const char *filename); const OBRect *Collide (const Point3D& start,const Point3D& end) const; const OBRect *Inside (const Point3D& pt) const; void BridgeKilled (int id); }; }; #endif