#include <Level.h>
Public Types | |
typedef vector< Unit * > | UnitList |
typedef vector< Team * > | TeamList |
typedef VectorIterator< TeamList > | TeamIterator |
Public Member Functions | |
Level () | |
~Level (void) | |
void | setDimensions (int cellsWide, int cellsHigh) |
Sets the dimension of the grid. | |
void | setWorldDimensions (float worldWidth, float worldHeight) |
void | setCellSize (float width, float height) |
void | reset () |
Resets the occupied status of all squares on the grid. | |
void | rebuild () |
Team * | createTeam (const String &teamName, const ColourValue &teamColor) |
void | removeAllTeams () |
void | removeTeam (const String &teamName) |
void | removeTeam (Team *team) |
size_t | getNumTeams () |
Team * | getTeam (size_t teamIndex) |
TeamList | getEnemyTeams (const Team *friendlyTeam) |
TeamIterator | getTeamIterator () |
LevelNode * | getNode (const Vector3 &worldPos) |
void | getCellLocation (const Vector3 &worldPos, int *x, int *z) |
Vector3 | getNodeWorldPosition (int cellX, int cellZ) |
LevelNode * | getClosestNode (const Vector3 &worldPos) |
UnitList | getAdjacentUnits (const Vector3 &position, float radius) |
Returns a list of all the units within the given radius of the position. | |
void | occupy (float worldX, float worldZ) |
Occupies the square given which would be under (worldX, worldZ) which assumes the map hasn't been rotated. | |
void | unoccupy (float worldX, float worldZ) |
void | occupyRegion (const AxisAlignedBox &worldRegion) |
void | unoccupyRegion (const AxisAlignedBox &worldRegion) |
bool | isOccupied (float worldX, float worldZ) |
Determines if the given coordinates are already occupied by something. | |
int | getWorldHeight () const |
Retrieve the size of the world. | |
int | getWorldWidth () const |
Retrieve the size of the world. | |
int | getNumNodesWide () const |
Retrieve the number of 'level nodes' in the x-axis. | |
int | getNumNodesHigh () const |
Retrieve the number of 'level nodes' in the z-axis. | |
AStarSearchManager< LevelNode > * | getPathManager () const |
Retrieves the pathing manager. | |
Static Public Member Functions | |
static Level & | getSingleton (void) |
Override standard Singleton retrieval. | |
static Level * | getSingletonPtr (void) |
Override standard Singleton retrieval. | |
Protected Member Functions | |
void | _markCell (float worldX, float worldZ, bool status) |
Private Member Functions | |
Team * | _findTeam (const String &teamName) const |
Private Attributes | |
int | mCellsWide |
The number of grid squares per dimension. | |
int | mCellsHigh |
float | mCellWidth |
The size of the grid cells. | |
float | mCellHeight |
float | mWorldWidth |
The world space dimensions this Level overlays. | |
float | mWorldHeight |
AStarSearchManager< LevelNode > * | mPathManager |
vector< LevelNode > | mOccupied |
Cell occupied status ( column + [row * mCellsWide] form). | |
TeamList | mTeams |
Friends | |
class | LevelStatusVisualizer |
Debugging utility. | |
Classes | |
class | LevelNode |
Users specify the world space dimensions of the map this Level should overlay as well as the dimensions of the grid system used by the Level. For example, a world that is 100x100 may contain a level which uses a grid system of 10x10. This would obviously result in poor path finding.
A grid square is occupied if any object is within the bounds of the world space area the grid square covers. In the example above, if any unit is in the first 10x10 area in world space, the entire area is marked as being occupied. Smaller regions should be used to allow only a single unit to stand in a grid square.
NOTE Almost every method in this class is dependent on the resolution of the grid.
TODO Support paging so that the map can be broken up into smaller pieces.
Add support for rotated maps
Definition at line 53 of file Level.h.
typedef VectorIterator<TeamList> ASR::Level::TeamIterator |
typedef vector<Team*> ASR::Level::TeamList |
typedef vector<Unit*> ASR::Level::UnitList |
ASR::Level::Level | ( | ) |
Definition at line 34 of file Level.cpp.
References mCellHeight, mCellsHigh, mCellsWide, mCellWidth, mOccupied, mPathManager, mWorldHeight, and mWorldWidth.
00035 { 00036 mOccupied.clear (); 00037 mCellsWide = 0; 00038 mCellsHigh = 0; 00039 00040 mCellWidth = 0.0f; 00041 mCellHeight = 0.0f; 00042 00043 mWorldWidth = 0.0f; 00044 mWorldHeight = 0.0f; 00045 00046 mPathManager = new AStarSearchManager<Level::LevelNode> (); 00047 }
ASR::Level::~Level | ( | void | ) |
Definition at line 51 of file Level.cpp.
References mOccupied, mPathManager, and removeAllTeams().
00052 { 00053 mOccupied.clear (); 00054 removeAllTeams (); 00055 00056 delete mPathManager; 00057 }
Team * ASR::Level::_findTeam | ( | const String & | teamName | ) | const [private] |
Definition at line 314 of file Level.cpp.
References mTeams.
Referenced by createTeam().
00315 { 00316 TeamList::const_iterator iter = mTeams.begin(); 00317 while ( iter != mTeams.end() ) 00318 { 00319 if ( (*iter)->getName() == teamName ) 00320 { 00321 return ( *iter ); 00322 } 00323 iter++; 00324 } 00325 00326 return NULL; 00327 }
void ASR::Level::_markCell | ( | float | worldX, | |
float | worldZ, | |||
bool | status | |||
) | [protected] |
Definition at line 384 of file Level.cpp.
References mCellHeight, mCellsHigh, mCellsWide, mCellWidth, and mOccupied.
Referenced by occupyRegion(), and unoccupyRegion().
00385 { 00386 assert ( mCellWidth > 0.0f ); 00387 assert ( mCellHeight > 0.0f ); 00388 00389 assert ( worldX >= 0.0f ); 00390 assert ( worldZ >= 0.0f ); 00391 00392 int cellX; 00393 int cellY; 00394 00395 cellX = int(floor(worldX / mCellWidth)); 00396 cellY = int(floor(worldZ / mCellHeight )); 00397 00398 if ( cellX >= mCellsWide || cellY >= mCellsHigh ) 00399 throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Position is outside of the bounds of the terrain", "Level::_markCell" ); 00400 00401 float cost; 00402 cost = ( status ) ? -1.0f : 1.0f; 00403 mOccupied[cellX + cellY * mCellsWide].setTraversalCost ( cost ); 00404 }
Team * ASR::Level::createTeam | ( | const String & | teamName, | |
const ColourValue & | teamColor | |||
) |
Definition at line 195 of file Level.cpp.
References _findTeam(), and mTeams.
Referenced by TutorialApplication::_createTeamB(), TutorialApplication::_createTeamC(), and ASR::Client::createTeam().
00196 { 00197 if ( _findTeam ( teamName ) != NULL ) 00198 throw Exception ( Exception::ERR_DUPLICATE_ITEM, "Team already exists", "Level::createTeam" ); 00199 00200 Team* newTeam = new Team ( teamName, teamColor ); 00201 mTeams.push_back ( newTeam ); 00202 00203 // TODO 00204 // Register an updater for the team 00205 return newTeam; 00206 }
Level::UnitList ASR::Level::getAdjacentUnits | ( | const Vector3 & | position, | |
float | radius | |||
) |
Returns a list of all the units within the given radius of the position.
Definition at line 331 of file Level.cpp.
Referenced by ASR::Team::findTargets().
00332 { 00333 UnitList units; 00334 00335 // TODO 00336 // Loop over each team 00337 // Loop over each unit from each team 00338 // if the unit is within 'radius' units of 'position' 00339 // add it to the list 00340 // 00341 // This can be done a lot more efficiently with a quadtree structure 00342 return units; 00343 }
void ASR::Level::getCellLocation | ( | const Vector3 & | worldPos, | |
int * | x, | |||
int * | z | |||
) |
Definition at line 469 of file Level.cpp.
References mCellHeight, mCellsHigh, mCellsWide, and mCellWidth.
Referenced by ASR::LevelStatusVisualizer::_paintUnitPaths().
00470 { 00471 (*x) = int(floor(worldPos.x / mCellWidth)); 00472 (*z) = int(floor(worldPos.z / mCellHeight )); 00473 00474 if ( (*x) >= mCellsWide || (*z) >= mCellsHigh || (*z) < 0 || (*x) < 0 ) 00475 throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Position is outside of the bounds of the terrain", "Level::getCellLocation" ); 00476 }
Level::LevelNode * ASR::Level::getClosestNode | ( | const Vector3 & | worldPos | ) |
Definition at line 408 of file Level.cpp.
References ASR::Level::LevelNode::getNeighbour(), ASR::Level::LevelNode::getNumNeighbours(), ASR::Level::LevelNode::getTraversalCost(), mCellHeight, mCellsHigh, mCellsWide, mCellWidth, ASR::Level::LevelNode::mChecked, and mOccupied.
Referenced by ASR::UnitSelecter::_moveUnits().
00409 { 00410 assert ( mCellWidth > 0.0f ); 00411 assert ( mCellHeight > 0.0f ); 00412 00413 assert ( worldPos.x >= 0.0f ); 00414 assert ( worldPos.z >= 0.0f ); 00415 00416 int cellX = int(floor(worldPos.x / mCellWidth)); 00417 int cellY = int(floor(worldPos.z / mCellHeight )); 00418 00419 if ( cellX >= mCellsWide || cellY >= mCellsHigh ) 00420 throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Position is out of the terrain bounds", "Level::getClosestNode" ); 00421 00422 if ( mOccupied[cellX + cellY * mCellsWide].getTraversalCost () >= 0.0f ) 00423 return &mOccupied[cellX + cellY * mCellsWide]; 00424 00425 // Perform a breadth-first search to find the closest cell 00426 std::queue<Level::LevelNode*> open; 00427 mOccupied[cellX + cellY * mCellsWide].mChecked = true; 00428 open.push ( &mOccupied[cellX + cellY * mCellsWide] ); 00429 00430 // TODO 00431 // Come up with a better way other than resetting every single node 00432 // in the entire level 00433 for ( int z = 0; z < mCellsHigh; z++ ) 00434 { 00435 for ( int x = 0; x < mCellsWide; x++ ) 00436 { 00437 mOccupied[x + z * mCellsWide].mChecked = false; 00438 } 00439 } 00440 00441 Level::LevelNode* node; 00442 Level::LevelNode* curNeighbour; 00443 while ( !open.empty() ) 00444 { 00445 node = open.front(); 00446 open.pop(); 00447 for ( int i = 0; i < node->getNumNeighbours (); i++ ) 00448 { 00449 curNeighbour = node->getNeighbour (i); 00450 if ( !curNeighbour->mChecked ) 00451 { 00452 // We found a neighbour that we can use 00453 if ( curNeighbour->getTraversalCost () >= 0.0f ) 00454 { 00455 return curNeighbour; 00456 } 00457 00458 curNeighbour->mChecked = true; 00459 open.push ( curNeighbour ); 00460 } 00461 } 00462 } 00463 00464 throw Exception ( Exception::ERR_INTERNAL_ERROR, "Cannot find a valid node in the entire level", "Level::getClosestNode" ); 00465 }
Level::TeamList ASR::Level::getEnemyTeams | ( | const Team * | friendlyTeam | ) |
Definition at line 284 of file Level.cpp.
References mTeams.
Referenced by ASR::ClientUpdater::_findVisibleObjects(), and ASR::TeamUnits::findTargets().
00285 { 00286 TeamList enemyTeams; 00287 00288 TeamList::iterator baseTeam = find ( mTeams.begin(), mTeams.end(), friendlyTeam ); 00289 if ( baseTeam == mTeams.end() ) 00290 throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Couldn't find team", "Level::getEnemyTeams" ); 00291 00292 TeamList::iterator curIter = mTeams.begin(); 00293 00294 // Up to but not including the base team 00295 while ( curIter != baseTeam ) 00296 { 00297 enemyTeams.push_back ( *curIter ); 00298 curIter++; 00299 } 00300 00301 // Now the other half of the list 00302 curIter = baseTeam + 1; 00303 while (curIter != mTeams.end() ) 00304 { 00305 enemyTeams.push_back ( *curIter ); 00306 curIter++; 00307 } 00308 00309 return enemyTeams; 00310 }
Level::LevelNode * ASR::Level::getNode | ( | const Vector3 & | worldPos | ) |
Definition at line 61 of file Level.cpp.
References mCellHeight, mCellsHigh, mCellsWide, mCellWidth, and mOccupied.
00062 { 00063 assert ( mCellWidth > 0.0f ); 00064 assert ( mCellHeight > 0.0f ); 00065 00066 assert ( worldPos.x >= 0.0f ); 00067 assert ( worldPos.z >= 0.0f ); 00068 00069 int cellX = int(floor(worldPos.x / mCellWidth)); 00070 int cellY = int(floor(worldPos.z / mCellHeight )); 00071 00072 if ( cellX >= mCellsWide || cellY >= mCellsHigh ) 00073 throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Position is outside of the terrain bounds", "Level::getNode" ); 00074 00075 return &mOccupied[cellX + cellY * mCellsWide]; 00076 }
Vector3 ASR::Level::getNodeWorldPosition | ( | int | cellX, | |
int | cellZ | |||
) |
Definition at line 181 of file Level.cpp.
References mCellHeight, and mCellWidth.
00182 { 00183 float worldPosX = cellX * mCellWidth; 00184 float worldPosY = cellZ * mCellHeight; 00185 00186 return Vector3( worldPosX, 0.0f, worldPosY ); 00187 }
int ASR::Level::getNumNodesHigh | ( | ) | const |
Retrieve the number of 'level nodes' in the z-axis.
Definition at line 501 of file Level.cpp.
References mCellsHigh.
Referenced by ASR::TeamUnits::getAdjacentUnits(), and ASR::FogOfWar::isUnitVisible().
00502 { 00503 return mCellsHigh; 00504 }
int ASR::Level::getNumNodesWide | ( | ) | const |
Retrieve the number of 'level nodes' in the x-axis.
Definition at line 494 of file Level.cpp.
References mCellsWide.
Referenced by ASR::TeamUnits::getAdjacentUnits(), and ASR::FogOfWar::isUnitVisible().
00495 { 00496 return mCellsWide; 00497 }
size_t ASR::Level::getNumTeams | ( | ) |
AStarSearchManager< Level::LevelNode > * ASR::Level::getPathManager | ( | ) | const |
Retrieves the pathing manager.
TODO Move this into it's own PathManager so that we can just retrieve the interface and use a generic pathing engine instead of relying on the fact that we are using A*
Definition at line 508 of file Level.cpp.
References mPathManager.
00509 { 00510 return mPathManager; 00511 }
Level & ASR::Level::getSingleton | ( | void | ) | [static] |
Override standard Singleton retrieval.
Definition at line 28 of file Level.cpp.
Referenced by ASR::ClientUpdater::_findVisibleObjects(), ASR::UnitSelecter::_moveUnits(), ASR::Building::Building(), ASR::Client::createTeam(), ASR::TeamUnits::findTargets(), ASR::Team::findTargets(), ASR::TeamUnits::getAdjacentUnits(), ASR::FogOfWar::isUnitVisible(), ASR::FogOfWar::setVisible(), ASR::Team::Team(), ASR::Building::translate(), and ASR::TeamUnits::updateSpatialGrid().
Level * ASR::Level::getSingletonPtr | ( | void | ) | [static] |
Override standard Singleton retrieval.
Definition at line 24 of file Level.cpp.
Team * ASR::Level::getTeam | ( | size_t | teamIndex | ) |
Level::TeamIterator ASR::Level::getTeamIterator | ( | ) |
Definition at line 277 of file Level.cpp.
References mTeams.
Referenced by ASR::LevelStatusVisualizer::_paintUnitPaths().
00278 { 00279 return TeamIterator ( mTeams.begin(), mTeams.end() ); 00280 }
int ASR::Level::getWorldHeight | ( | ) | const |
Retrieve the size of the world.
Definition at line 487 of file Level.cpp.
References mWorldHeight.
Referenced by ASR::TeamUnits::getAdjacentUnits(), ASR::FogOfWar::isUnitVisible(), and ASR::TeamUnits::updateSpatialGrid().
00488 { 00489 return mWorldHeight; 00490 }
int ASR::Level::getWorldWidth | ( | ) | const |
Retrieve the size of the world.
Definition at line 480 of file Level.cpp.
References mWorldWidth.
Referenced by ASR::TeamUnits::getAdjacentUnits(), ASR::FogOfWar::isUnitVisible(), and ASR::TeamUnits::updateSpatialGrid().
00481 { 00482 return mWorldWidth; 00483 }
bool ASR::Level::isOccupied | ( | float | worldX, | |
float | worldZ | |||
) |
Determines if the given coordinates are already occupied by something.
void ASR::Level::occupy | ( | float | worldX, | |
float | worldZ | |||
) |
Occupies the square given which would be under (worldX, worldZ) which assumes the map hasn't been rotated.
void ASR::Level::occupyRegion | ( | const AxisAlignedBox & | worldRegion | ) |
Definition at line 347 of file Level.cpp.
References _markCell(), mCellHeight, and mCellWidth.
Referenced by ASR::Building::Building(), and ASR::Building::translate().
00348 { 00349 // TODO 00350 // Possibly use only 90% of mCellHeight to account for floating point 00351 // errors which may end up making us skip a cell. With 90%, we have 00352 // overlap but at least we cover all the cells 00353 for ( float worldZ = worldRegion.getMinimum ().z; worldZ < worldRegion.getMaximum ().z; worldZ += mCellHeight ) 00354 { 00355 for ( float worldX = worldRegion.getMinimum ().x; worldX < worldRegion.getMaximum ().x; worldX += mCellWidth ) 00356 { 00357 _markCell ( worldX, worldZ, true ); 00358 } 00359 } 00360 }
void ASR::Level::rebuild | ( | ) |
Definition at line 119 of file Level.cpp.
References mCellHeight, mCellsHigh, mCellsWide, mCellWidth, and mOccupied.
Referenced by TutorialApplication::createScene().
00120 { 00121 mOccupied.clear (); 00122 unsigned int Id = 0; 00123 00124 for ( int z = 0; z < mCellsHigh; z++ ) 00125 { 00126 for ( int x = 0; x < mCellsWide; x++ ) 00127 { 00128 LevelNode node ( Vector3(x * mCellWidth, 0, z * mCellHeight ) ); 00129 node.mId = Id++; 00130 mOccupied.push_back ( node ); 00131 } 00132 } 00133 00134 // Assign neighbours now that the level is built 00135 for ( int z = 0; z < mCellsHigh; z++ ) 00136 { 00137 for ( int x = 0; x < mCellsWide; x++ ) 00138 { 00139 LevelNode& node = mOccupied[z * mCellsWide + x]; 00140 node.mNumNeighbours = 0; 00141 00142 // Use the tile above this one 00143 if ( z != 0 ) 00144 node.mNeighbours[node.mNumNeighbours++] = &mOccupied[(z - 1) * mCellsWide + x]; 00145 00146 // Use the tile below this one 00147 if ( z < (mCellsHigh - 1) ) 00148 node.mNeighbours[node.mNumNeighbours++] = &mOccupied[(z + 1) * mCellsWide + x]; 00149 00150 // Use the tile to the left of this one 00151 if ( x != 0 ) 00152 node.mNeighbours[node.mNumNeighbours++] = &mOccupied[( z ) * mCellsWide + (x - 1)]; 00153 00154 // Use the tile to the right of this one 00155 if ( x < (mCellsWide - 1) ) 00156 node.mNeighbours[node.mNumNeighbours++] = &mOccupied[( z ) * mCellsWide + (x + 1)]; 00157 00158 00159 // Use the top-left tile 00160 if ( x > 0 && z > 0 ) 00161 node.mNeighbours[node.mNumNeighbours++] = &mOccupied[( z - 1 ) * mCellsWide + ( x - 1 )]; 00162 00163 // Use the top-right tile 00164 if ( x < (mCellsWide - 1) && z > 0 ) 00165 node.mNeighbours[node.mNumNeighbours++] = &mOccupied[( z - 1 ) * mCellsWide + ( x + 1 )]; 00166 00167 // Use the bottom-left tile 00168 if ( x > 0 && z < (mCellsHigh - 1) ) 00169 node.mNeighbours[node.mNumNeighbours++] = &mOccupied[( z + 1 ) * mCellsWide + ( x - 1 )]; 00170 00171 // Use the bottom-right tile 00172 if ( x < (mCellsWide - 1) && z < (mCellsHigh - 1) ) 00173 node.mNeighbours[node.mNumNeighbours++] = &mOccupied[( z + 1 ) * mCellsWide + ( x + 1 )]; 00174 00175 } 00176 } 00177 }
void ASR::Level::removeAllTeams | ( | ) |
void ASR::Level::removeTeam | ( | Team * | team | ) |
Definition at line 243 of file Level.cpp.
References mTeams.
00244 { 00245 TeamList::iterator iter = mTeams.begin(); 00246 while ( iter != mTeams.end() ) 00247 { 00248 if ( (*iter) == team ) 00249 { 00250 delete (*iter); 00251 mTeams.erase ( iter ); 00252 return; 00253 } 00254 iter++; 00255 } 00256 00257 throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Cannot find team", "Team::removeTeam" ); 00258 }
void ASR::Level::removeTeam | ( | const String & | teamName | ) |
Definition at line 224 of file Level.cpp.
References mTeams.
00225 { 00226 TeamList::iterator iter = mTeams.begin(); 00227 while ( iter != mTeams.end () ) 00228 { 00229 if ( (*iter)->getName() == teamName ) 00230 { 00231 delete (*iter); 00232 mTeams.erase ( iter ); 00233 return; 00234 } 00235 iter++; 00236 } 00237 00238 throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Cannot find team", "Team::removeTeam" ); 00239 }
void ASR::Level::reset | ( | ) |
void ASR::Level::setCellSize | ( | float | width, | |
float | height | |||
) |
Definition at line 99 of file Level.cpp.
References mCellHeight, mCellsHigh, mCellsWide, mCellWidth, mWorldHeight, and mWorldWidth.
00100 { 00101 mCellWidth = width; 00102 mCellHeight = height; 00103 00104 // There may be only a little bit of a cell at the edges 00105 mCellsWide = int(ceil( mWorldWidth / mCellWidth )); 00106 mCellsHigh = int(ceil( mWorldHeight / mCellHeight )); 00107 }
void ASR::Level::setDimensions | ( | int | cellsWide, | |
int | cellsHigh | |||
) |
Sets the dimension of the grid.
Previous occupied status is maintained for squares that remain valid (in the new dimensions) after the call. A call to 'reset' can change them
Grid square sizes are determined by [worldWidth / cellsWide] and [worldHeight / cellsHigh]. If control over the size of the grid squares is desired, use setCellSize instead.
Definition at line 80 of file Level.cpp.
References mCellHeight, mCellsHigh, mCellsWide, mCellWidth, mWorldHeight, and mWorldWidth.
Referenced by TutorialApplication::createScene().
00081 { 00082 mCellsWide = cellsWide; 00083 mCellsHigh = cellsHigh; 00084 00085 mCellWidth = mWorldWidth / (float)mCellsWide; 00086 mCellHeight = mWorldHeight / (float)mCellsHigh; 00087 }
void ASR::Level::setWorldDimensions | ( | float | worldWidth, | |
float | worldHeight | |||
) |
Definition at line 91 of file Level.cpp.
References mWorldHeight, and mWorldWidth.
Referenced by TutorialApplication::createScene().
00092 { 00093 mWorldWidth = worldWidth; 00094 mWorldHeight = worldHeight; 00095 }
void ASR::Level::unoccupy | ( | float | worldX, | |
float | worldZ | |||
) |
void ASR::Level::unoccupyRegion | ( | const AxisAlignedBox & | worldRegion | ) |
Definition at line 364 of file Level.cpp.
References _markCell(), mCellHeight, and mCellWidth.
Referenced by ASR::Building::translate().
00365 { 00366 // TODO 00367 // Possibly use only 90% of mCellHeight to account for floating point 00368 // errors which may end up making us skip a cell. With 90%, we have 00369 // overlap but at least we cover all the cells 00370 float startX = (worldRegion.getMinimum ().x < 0.0f) ? 0.0f : worldRegion.getMinimum ().x; 00371 float startZ = (worldRegion.getMinimum ().z < 0.0f) ? 0.0f : worldRegion.getMinimum ().z; 00372 00373 for ( float worldZ = startZ; worldZ < worldRegion.getMaximum ().z; worldZ += mCellHeight ) 00374 { 00375 for ( float worldX = startX; worldX < worldRegion.getMaximum ().x; worldX += mCellWidth ) 00376 { 00377 _markCell ( worldX, worldZ, false ); 00378 } 00379 } 00380 }
friend class LevelStatusVisualizer [friend] |
float ASR::Level::mCellHeight [private] |
Definition at line 169 of file Level.h.
Referenced by _markCell(), getCellLocation(), getClosestNode(), getNode(), getNodeWorldPosition(), Level(), occupyRegion(), rebuild(), setCellSize(), setDimensions(), and unoccupyRegion().
int ASR::Level::mCellsHigh [private] |
Definition at line 165 of file Level.h.
Referenced by _markCell(), ASR::LevelStatusVisualizer::_paintBlockedTiles(), getCellLocation(), getClosestNode(), getNode(), getNumNodesHigh(), Level(), ASR::LevelStatusVisualizer::LevelStatusVisualizer(), rebuild(), setCellSize(), and setDimensions().
int ASR::Level::mCellsWide [private] |
The number of grid squares per dimension.
Definition at line 164 of file Level.h.
Referenced by _markCell(), ASR::LevelStatusVisualizer::_paintBlockedTiles(), ASR::LevelStatusVisualizer::_paintUnitPaths(), getCellLocation(), getClosestNode(), getNode(), getNumNodesWide(), Level(), ASR::LevelStatusVisualizer::LevelStatusVisualizer(), rebuild(), setCellSize(), and setDimensions().
float ASR::Level::mCellWidth [private] |
The size of the grid cells.
Definition at line 168 of file Level.h.
Referenced by _markCell(), getCellLocation(), getClosestNode(), getNode(), getNodeWorldPosition(), Level(), occupyRegion(), rebuild(), setCellSize(), setDimensions(), and unoccupyRegion().
vector<LevelNode> ASR::Level::mOccupied [private] |
Cell occupied status ( column + [row * mCellsWide] form).
Definition at line 178 of file Level.h.
Referenced by _markCell(), ASR::LevelStatusVisualizer::_paintBlockedTiles(), getClosestNode(), getNode(), Level(), rebuild(), reset(), and ~Level().
AStarSearchManager<LevelNode>* ASR::Level::mPathManager [private] |
TeamList ASR::Level::mTeams [private] |
Definition at line 180 of file Level.h.
Referenced by _findTeam(), createTeam(), getEnemyTeams(), getNumTeams(), getTeam(), getTeamIterator(), removeAllTeams(), and removeTeam().
float ASR::Level::mWorldHeight [private] |
Definition at line 173 of file Level.h.
Referenced by getWorldHeight(), Level(), setCellSize(), setDimensions(), and setWorldDimensions().
float ASR::Level::mWorldWidth [private] |
The world space dimensions this Level overlays.
Definition at line 172 of file Level.h.
Referenced by getWorldWidth(), Level(), setCellSize(), setDimensions(), and setWorldDimensions().