UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AiAreaSearch Class Reference

AiAreaSearch class, used to get an area of the map around a certain position for the AI to check possible moving positions. More...

#include <g_ai.h>

Data Structures

class  LQueue
 A simple queue class. More...
 

Public Member Functions

 AiAreaSearch ()
 Initializes an AiAreaSearch object to default values. More...
 
 AiAreaSearch (const pos3_t origin, int radius, bool flat=false)
 Initializes an AiAreaSearch object with specific starting point and search radius. More...
 
 ~AiAreaSearch (void)
 Clear AiAreaSearch internal data. More...
 
bool getNext (pos3_t pos)
 Get next position in the search area. More...
 

Private Member Functions

void plotArea (const pos3_t origin, int radius, bool flat=false)
 Calculate the search area. More...
 
void plotCircle (const pos3_t origin, int radius)
 
void plotPos (const pos3_t origin, int xOfs, int yOfs)
 

Private Attributes

LQueue _area
 

Detailed Description

AiAreaSearch class, used to get an area of the map around a certain position for the AI to check possible moving positions.

Definition at line 33 of file g_ai.h.

Constructor & Destructor Documentation

AiAreaSearch::AiAreaSearch ( void  )

Initializes an AiAreaSearch object to default values.

Definition at line 56 of file g_ai.cpp.

References plotArea(), and pos3_origin.

AiAreaSearch::AiAreaSearch ( const pos3_t  origin,
int  radius,
bool  flat = false 
)

Initializes an AiAreaSearch object with specific starting point and search radius.

Definition at line 63 of file g_ai.cpp.

References plotArea().

AiAreaSearch::~AiAreaSearch ( void  )

Clear AiAreaSearch internal data.

Definition at line 70 of file g_ai.cpp.

References _area, and AiAreaSearch::LQueue::clear().

Member Function Documentation

bool AiAreaSearch::getNext ( pos3_t  pos)

Get next position in the search area.

Parameters
[out]posThe next position in the search area. return true if a new position was found false otherwise.

Definition at line 79 of file g_ai.cpp.

References _area, and AiAreaSearch::LQueue::dequeue().

Referenced by AI_FindHerdLocation(), AI_FindHidingLocation(), AI_FindMissionLocation(), AI_PrepBestAction(), AIL_positionflee(), AIL_positionshoot(), and AIL_positionwander().

void AiAreaSearch::plotArea ( const pos3_t  origin,
int  radius,
bool  flat = false 
)
private

Calculate the search area.

Parameters
[in]originThe starting position for the search.
[in]radiusRadius to search around the starting position.
[in]flatIf true only the level with the starting position is searched.

Definition at line 143 of file g_ai.cpp.

References i, PATHFINDING_HEIGHT, and plotCircle().

Referenced by AiAreaSearch().

void AiAreaSearch::plotCircle ( const pos3_t  origin,
int  radius 
)
private

Definition at line 165 of file g_ai.cpp.

References PATHFINDING_HEIGHT, and plotPos().

Referenced by plotArea().

void AiAreaSearch::plotPos ( const pos3_t  origin,
int  xOfs,
int  yOfs 
)
private

Definition at line 203 of file g_ai.cpp.

References _area, AiAreaSearch::LQueue::enqueue(), gi, PATHFINDING_WIDTH, and PosToVec.

Referenced by plotCircle().

Field Documentation

LQueue AiAreaSearch::_area
private

Queue containing the positions in the search area

Definition at line 70 of file g_ai.h.

Referenced by getNext(), plotPos(), and ~AiAreaSearch().


The documentation for this class was generated from the following files: