Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Map::WorldMap Struct Reference

#include <Map.h>

Collaboration diagram for Map::WorldMap:

Collaboration graph
[legend]
List of all members.

Detailed Description

Holds dimension data for the overhead view. Basically creates a bounding rectangle that should contain ALL units and structures in the game. Failure to keep a unit or structure inside this bounding rectangle will cause problems with the AI.

Definition at line 77 of file Map.h.

Public Methods

Int2Tuple worldToGridCoord (Vec3D loc)
 translates an absolute world coordinate to integer coordinates that give the grid cell of the map the absolute coordinate is contained in. Does NOT do bounds checking so you may get a value that is outside of the map.


Public Attributes

Rect bounds
FLOAT width
FLOAT height
int gridWidth
 grid is used to partition the map into discrete cells. usefull for the game ai.

int gridHeight


Member Function Documentation

Int2Tuple Map::WorldMap::worldToGridCoord Vec3D    loc [inline]
 

translates an absolute world coordinate to integer coordinates that give the grid cell of the map the absolute coordinate is contained in. Does NOT do bounds checking so you may get a value that is outside of the map.

Parameters:
loc the absolute world position.
Returns:
the (row, column) of the grid cell where the point is contained.

Definition at line 94 of file Map.h.

References Rect::bounds().

Referenced by AI::Player::buildThreatMap(), and AI::Player::CityLessThreatened::operator()().

00095     {
00096       return Int2Tuple(static_cast<int>((loc.y - this->bounds.bounds()[0].y) / (this->height /this->gridHeight)),
00097         static_cast<int>((loc.x - this->bounds.bounds()[0].x) / (this->width / this->gridWidth)));
00098     }


Member Data Documentation

Rect Map::WorldMap::bounds
 

Definition at line 79 of file Map.h.

Referenced by Map::createWorldMap(), MilitaryUnit::move(), HUD::processMiniMapInput(), Overhead::processOverheadInput(), HUD::translateMiniMapToWorld(), and HUD::translateWorldToMiniMap().

int Map::WorldMap::gridHeight
 

Definition at line 86 of file Map.h.

Referenced by AI::Player::buildThreatMap(), AI::Player::clearThreatMap(), and Map::createWorldMap().

int Map::WorldMap::gridWidth
 

grid is used to partition the map into discrete cells. usefull for the game ai.

Definition at line 85 of file Map.h.

Referenced by AI::Player::buildThreatMap(), AI::Player::clearThreatMap(), and Map::createWorldMap().

FLOAT Map::WorldMap::height
 

Definition at line 83 of file Map.h.

Referenced by Map::createWorldMap(), and HUD::setWorldMap().

FLOAT Map::WorldMap::width
 

Definition at line 82 of file Map.h.

Referenced by Map::createWorldMap(), and HUD::setWorldMap().


The documentation for this struct was generated from the following file:
Generated on Wed Apr 23 05:52:18 2003 for Modern Warfare by doxygen1.3-rc2