Main Page | Class List | File List | Class Members | Related Pages

WDS::CTownArray Class Reference

#include <townarray.h>

List of all members.

Public Member Functions

CTownget (int x, int y)
void set (int x, int y, CTown town)
void erase (int x, int y)
void clear ()
unsigned int size ()
CTownfirstSibling ()
CTownnextSibling ()


Detailed Description

The class CTownArray provides (hopefully) fast access to all towns. Add towns with

Example:

 // assume ta is our CTownArray
 CTown* town = ta.get(34, 65);
 if ( town != 0L ) { } // valid town
 ta.set(65, 12, town);

 // iterate through all towns
 town = ta.firstSibling();
 while (town != 0L) {
     // do something with town...
     town = ta.nextSibling();
 }
Note:
Shall I switch this class to a template? Array2D<CTown> ... ?

Definition at line 53 of file townarray.h.


Member Function Documentation

void WDS::CTownArray::clear  ) 
 

remove all towns (size = 0)

Definition at line 82 of file townarray.cpp.

void WDS::CTownArray::erase int  x,
int  y
 

erase CTown at position (x,y)

Definition at line 63 of file townarray.cpp.

Referenced by WDS::CMap::Update().

CTown * WDS::CTownArray::firstSibling  ) 
 

Get first CTown* to iterate through all towns.

Returns:
CTown* or NULL of not found.

Definition at line 115 of file townarray.cpp.

CTown * WDS::CTownArray::get int  x,
int  y
 

Returns:
town at position (x,y) or NULL of not found

Definition at line 39 of file townarray.cpp.

Referenced by WDS::CMap::GetTownAt(), and WDS::CMap::Update().

CTown * WDS::CTownArray::nextSibling  ) 
 

Get next CTown* to iterate through all towns.

Returns:
CTown* or NULL of not found.

Definition at line 131 of file townarray.cpp.

void WDS::CTownArray::set int  x,
int  y,
CTown  town
 

add new town at position (x,y). If the town already exists, it will be overwritten.

Definition at line 54 of file townarray.cpp.

Referenced by WDS::CMap::Update().

unsigned int WDS::CTownArray::size  ) 
 

Returns:
number of towns/size

Definition at line 100 of file townarray.cpp.


The documentation for this class was generated from the following files:
Generated on Sun Jan 16 18:20:28 2005 for WDSMap by  doxygen 1.3.9.1