_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
CMap Class Reference

Describes the world map. More...

#include <map.h>

Public Member Functions

unsigned int getIndex (int x, int y) const
 
unsigned int getIndex (const Vec2i &pos) const
 
CMapFieldField (unsigned int index) const
 
CMapFieldField (int x, int y) const
 Get the MapField at location x,y. More...
 
CMapFieldField (const Vec2i &pos) const
 
void FixSelectionArea (Vec2i &minpos, Vec2i &maxpos)
 
map_wall.cpp - The map wall handling.
void HitWall (const Vec2i &pos, unsigned damage)
 Wall is hit. More...
 
void RemoveWall (const Vec2i &pos)
 Set wall on field. More...
 
void SetWall (const Vec2i &pos, bool humanwall)
 Set wall on field. More...
 
unit_cache.cpp - The unit cache.
void Insert (CUnit &unit)
 Insert new unit into cache. More...
 
void Remove (CUnit &unit)
 Remove unit from cache. More...
 
void Clamp (Vec2i &pos) const
 

Public Attributes

CMapFieldFields
 
bool NoFogOfWar
 fields on map More...
 
CTilesetTileset
 fog of war disabled More...
 
std::string TileModelsFileName
 tileset data More...
 
CGraphicTileGraphic
 lua filename that loads all tilemodels More...
 
CMapInfo Info
 graphic for fog of war More...
 

map.cpp - The map.

 CMap ()
 
 ~CMap ()
 
void Create ()
 Alocate and initialise map table. More...
 
void Init ()
 Build tables for map. More...
 
void Clean ()
 Clean the map. More...
 
void ClearWoodTile (const Vec2i &pos)
 Remove wood from the map. More...
 
void ClearRockTile (const Vec2i &pos)
 Remove rock from the map. More...
 
Vec2i MapPixelPosToTilePos (const PixelPos &mapPos) const
 convert map pixelpos coordonates into tilepos More...
 
PixelPos TilePosToMapPixelPos_TopLeft (const Vec2i &tilePos) const
 convert tilepos coordonates into map pixel pos (take the top left of the tile) More...
 
PixelPos TilePosToMapPixelPos_Center (const Vec2i &tilePos) const
 convert tilepos coordonates into map pixel pos (take the center of the tile) More...
 
void MarkSeenTile (CMapField &mf)
 Mark a tile as seen by the player. More...
 
void RegenerateForest ()
 Regenerate the forest. More...
 
void Reveal ()
 Reveal the complete map, make everything known. More...
 
void Save (CFile &file) const
 Save the map. More...
 
bool WallOnMap (const Vec2i &pos) const
 Returns true, if wall on the map tile field. More...
 
bool HumanWallOnMap (const Vec2i &pos) const
 Returns true, if human wall on the map tile field. More...
 
bool OrcWallOnMap (const Vec2i &pos) const
 Returns true, if orc wall on the map tile field. More...
 

map_fog.cpp - The map fog of war handling.

static CGraphicFogGraphic
 graphic for all the tiles More...
 
void CleanFogOfWar ()
 Cleanup memory for fog of war tables. More...
 

Detailed Description

Describes the world map.

#include "map.h"

This class contains all information about a Stratagus map. A map is a rectangle of any size.

The map class members:

CMap::Fields

An array CMap::Info::Width * CMap::Info::Height of all fields belonging to this map.

CMap::NoFogOfWar

Flag if true, the fog of war is disabled.

CMap::Tileset

Tileset data for the map. See CTileset. This contains all information about the tile.

CMap::TileModelsFileName

Lua filename that loads all tilemodels

CMap::TileGraphic

Graphic for all the tiles

CMap::FogGraphic

Graphic for fog of war

CMap::Info

Descriptive information of the map. See CMapInfo.

Constructor & Destructor Documentation

CMap::CMap ( )
CMap::~CMap ( )

Member Function Documentation

void CMap::Clamp ( Vec2i pos) const
void CMap::Clean ( )

Clean the map.

Cleanup the map module.

void CMap::CleanFogOfWar ( )

Cleanup memory for fog of war tables.

Cleanup the fog of war.

void CMap::ClearRockTile ( const Vec2i pos)

Remove rock from the map.

void CMap::ClearWoodTile ( const Vec2i pos)

Remove wood from the map.

void CMap::Create ( )

Alocate and initialise map table.

Alocate and initialise map table

CMapField* CMap::Field ( unsigned int  index) const
inline
CMapField* CMap::Field ( int  x,
int  y 
) const
inline

Get the MapField at location x,y.

CMapField* CMap::Field ( const Vec2i pos) const
inline
void CMap::FixSelectionArea ( Vec2i minpos,
Vec2i maxpos 
)
inline
unsigned int CMap::getIndex ( int  x,
int  y 
) const
inline
unsigned int CMap::getIndex ( const Vec2i pos) const
inline
void CMap::HitWall ( const Vec2i pos,
unsigned  damage 
)

Wall is hit.

Wall is hit with damage.

Parameters
posMap tile-position of wall.
damageDamage done to wall.
bool CMap::HumanWallOnMap ( const Vec2i pos) const

Returns true, if human wall on the map tile field.

Human wall on map tile.

Parameters
posmap tile position.
Returns
True if human wall, false otherwise.
void CMap::Init ( )

Build tables for map.

Initialize the fog of war. Build tables, setup functions.

void CMap::Insert ( CUnit unit)

Insert new unit into cache.

Insert new unit into cache.

Parameters
unitUnit pointer to place in cache.
Vec2i CMap::MapPixelPosToTilePos ( const PixelPos mapPos) const

convert map pixelpos coordonates into tilepos

void CMap::MarkSeenTile ( CMapField mf)

Mark a tile as seen by the player.

Path of the current map.

Marks seen tile – used mainly for the Fog Of War

Parameters
mfMapField-position.
bool CMap::OrcWallOnMap ( const Vec2i pos) const

Returns true, if orc wall on the map tile field.

Orc wall on map tile.

Parameters
posmap tile position.
Returns
True if orcish wall, false otherwise.
void CMap::RegenerateForest ( )

Regenerate the forest.

Regenerate forest.

void CMap::Remove ( CUnit unit)

Remove unit from cache.

Remove unit from cache.

Parameters
unitUnit pointer to remove from cache.
void CMap::RemoveWall ( const Vec2i pos)

Set wall on field.

Remove wall from the map.

Parameters
posMap position.

FIXME: support more walls of different races.

void CMap::Reveal ( )

Reveal the complete map, make everything known.

Reveal the entire map.

void CMap::Save ( CFile file) const

Save the map.

Save the complete map.

Parameters
fileOutput file.
void CMap::SetWall ( const Vec2i pos,
bool  humanwall 
)

Set wall on field.

Set wall onto the map.

Parameters
posMap position.
humanwallFlag, if true set a human wall.
Todo:
FIXME: support for more races.
PixelPos CMap::TilePosToMapPixelPos_Center ( const Vec2i tilePos) const

convert tilepos coordonates into map pixel pos (take the center of the tile)

PixelPos CMap::TilePosToMapPixelPos_TopLeft ( const Vec2i tilePos) const

convert tilepos coordonates into map pixel pos (take the top left of the tile)

bool CMap::WallOnMap ( const Vec2i pos) const

Returns true, if wall on the map tile field.

Wall on map tile.

Parameters
posmap tile position.
Returns
True if wall, false otherwise.

Member Data Documentation

CMapField* CMap::Fields
CGraphic * CMap::FogGraphic
static

graphic for all the tiles

CMapInfo CMap::Info

graphic for fog of war

bool CMap::NoFogOfWar

fields on map

CGraphic* CMap::TileGraphic

lua filename that loads all tilemodels

std::string CMap::TileModelsFileName

tileset data

CTileset* CMap::Tileset

fog of war disabled


The documentation for this class was generated from the following files:
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.