____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

CUnitCache Class Reference

#include <unit_cache.h>

List of all members.

Public Member Functions

void Init (int mapWidth, int mapHeight)
 < Initialize unit cache
void Insert (CUnit *unit)
 Remove unit from cache.
void Remove (CUnit *unit)
 Select units in range.
int Select (int x1, int y1, int x2, int y2, CUnit **table, int tablesize)
 Select units on tile.
int Select (int x, int y, CUnit **table, int tablesize)


Detailed Description

Unit cache

Definition at line 49 of file unit_cache.h.


Member Function Documentation

void CUnitCache::Init ( int  mapWidth,
int  mapHeight 
)

< Initialize unit cache

Insert new unit into cache

Initialize unit-cache.

Parameters:
mapWidth Map width
mapHeight Map height

Definition at line 56 of file unit_cache.cpp.

Referenced by CclStratagusMap(), CMap::Create(), and CEditor::Init().

void CUnitCache::Insert ( CUnit unit  ) 

Remove unit from cache.

Insert new unit into cache.

Parameters:
unit Unit pointer to place in cache.

Definition at line 73 of file unit_cache.cpp.

References Assert, CUnit::Removed, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CUnit::X, and CUnit::Y.

Referenced by LetUnitDie(), CUnit::MoveToXY(), and CUnit::Place().

void CUnitCache::Remove ( CUnit unit  ) 

Select units in range.

Remove unit from cache.

Parameters:
unit Unit pointer to remove from cache.

Definition at line 89 of file unit_cache.cpp.

References Assert, CUnit::Removed, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CUnit::X, and CUnit::Y.

Referenced by CUnit::MoveToXY(), and CUnit::Remove().

int CUnitCache::Select ( int  x1,
int  y1,
int  x2,
int  y2,
CUnit **  table,
int  tablesize 
)

int CUnitCache::Select ( int  x,
int  y,
CUnit **  table,
int  tablesize 
)

Select units on map tile.

Parameters:
x Map X tile position
y Map Y tile position
table All units in the selection rectangle
tablesize Size of table array
Returns:
Returns the number of units found

Definition at line 173 of file unit_cache.cpp.

References Assert.


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

Generated on Sat Feb 21 00:28:24 2009 for Bos Wars by  doxygen 1.5.6