Planeshift
LocationType Class Reference

This stores a vector of positions listing a set of points defining a common type of location, such as a list of burning fires or guard stations–whatever the NPCs need. More...

#include <location.h>

Public Member Functions

void AddLocation (Location *location)
 Add a new location to this location type. More...
 
bool CheckWithinBounds (iEngine *engine, const csVector3 &pos, const iSector *sector)
 Check if a point is within any of the locaitons of this location type. More...
 
bool CreateUpdate (iDataConnection *db)
 Create or update an entry for this location type in the DB. More...
 
int GetID () const
 retrive the ID of this location type. More...
 
const char * GetName () const
 retrive the name of this location type. More...
 
bool GetRandomPosition (iEngine *engine, csVector3 &pos, iSector *&sector, const iSector *inSector)
 Get a random position in the location. More...
 
bool Import (iDocumentNode *node, iDataConnection *db)
 
bool ImportLocations (iDocumentNode *node, iDataConnection *db)
 
bool Load (iDocumentNode *node)
 Load a location type from an XML file. More...
 
bool Load (iResultRow &row, iEngine *engine, iDataConnection *db)
 Load a location type from DB. More...
 
 LocationType ()
 Constructor. More...
 
 LocationType (int id, const csString &name)
 Constructor. More...
 
void RemoveLocation (Location *location)
 Remove a location from this location type. More...
 
 ~LocationType ()
 Destructor. More...
 

Public Attributes

int id
 The DB ID of this location type. More...
 
csArray< Location * > locs
 All the location of this location type. More...
 
csString name
 The name of this location type. More...
 

Detailed Description

This stores a vector of positions listing a set of points defining a common type of location, such as a list of burning fires or guard stations–whatever the NPCs need.

Definition at line 275 of file location.h.

Constructor & Destructor Documentation

LocationType::LocationType ( )

Constructor.

LocationType::LocationType ( int  id,
const csString &  name 
)

Constructor.

LocationType::~LocationType ( )

Destructor.

Member Function Documentation

void LocationType::AddLocation ( Location location)

Add a new location to this location type.

bool LocationType::CheckWithinBounds ( iEngine *  engine,
const csVector3 &  pos,
const iSector *  sector 
)

Check if a point is within any of the locaitons of this location type.

bool LocationType::CreateUpdate ( iDataConnection *  db)

Create or update an entry for this location type in the DB.

Note
Will update if there is a id different from -1.
int LocationType::GetID ( ) const
inline

retrive the ID of this location type.

Definition at line 337 of file location.h.

const char* LocationType::GetName ( ) const
inline

retrive the name of this location type.

Definition at line 344 of file location.h.

bool LocationType::GetRandomPosition ( iEngine *  engine,
csVector3 &  pos,
iSector *&  sector,
const iSector *  inSector 
)

Get a random position in the location.

Will return the position found. Do not relay on the state of the parameters if operation failes.

Parameters
engineUsed to find the sector
posThe found position is returned here.
sectorThe found sector is returned here.
inSectorIf set, only search for random pos in this sector.
Returns
True if position is found.
bool LocationType::Import ( iDocumentNode *  node,
iDataConnection *  db 
)
bool LocationType::ImportLocations ( iDocumentNode *  node,
iDataConnection *  db 
)
bool LocationType::Load ( iDocumentNode *  node)

Load a location type from an XML file.

bool LocationType::Load ( iResultRow &  row,
iEngine *  engine,
iDataConnection *  db 
)

Load a location type from DB.

void LocationType::RemoveLocation ( Location location)

Remove a location from this location type.

Member Data Documentation

int LocationType::id

The DB ID of this location type.

Definition at line 278 of file location.h.

csArray<Location*> LocationType::locs

All the location of this location type.

Definition at line 280 of file location.h.

csString LocationType::name

The name of this location type.

Definition at line 279 of file location.h.


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