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

Classes
map.h File Reference
#include "settings.h"
#include <string>
#include "tile.h"
#include "color.h"
#include "vec2i.h"

Go to the source code of this file.

Classes

class  CMapInfo
 
class  CMap
 Describes the world map. More...
 

map.h - The map headerfile.

#define MaxMapWidth   256
 
#define MaxMapHeight   256
 
typedef void MapMarkerFunc(const CPlayer &player, const unsigned int index)
 Function to (un)mark the vision table. More...
 
CMap Map
 
char CurrentMapPath [1024]
 The current map. More...
 
unsigned int ForestRegeneration
 Path to the current map. More...
 
int ForestRegenerationFrequency
 Forest regeneration. More...
 
MapRevealModes FlagRevealMap
 Flag must reveal the map. More...
 
int ReplayRevealMap
 Flag must reveal map when in replay. More...
 
MapMarkerFunc MapMarkTileSight
 Mark a tile for normal sight. More...
 
MapMarkerFunc MapUnmarkTileSight
 Unmark a tile for normal sight. More...
 
MapMarkerFunc MapMarkTileDetectCloak
 Mark a tile for cloak detection. More...
 
MapMarkerFunc MapUnmarkTileDetectCloak
 Unmark a tile for cloak detection. More...
 
MapMarkerFunc MapMarkTileRadar
 Mark a tile as radar visible, or incrase radar vision. More...
 
MapMarkerFunc MapUnmarkTileRadar
 Unmark a tile as radar visible, decrease is visible by other radar. More...
 
MapMarkerFunc MapMarkTileRadarJammer
 Mark a tile as radar jammed, or incrase radar jamming'ness. More...
 
MapMarkerFunc MapUnmarkTileRadarJammer
 Unmark a tile as jammed, decrease is jamming'ness. More...
 
int MapFogFilterFlags (CPlayer &player, const Vec2i &pos, int mask)
 Filter map flags through fog. More...
 
int MapFogFilterFlags (CPlayer &player, const unsigned int index, int mask)
 
void MapSight (const CPlayer &player, const CUnit &unit, const Vec2i &pos, int w, int h, int range, MapMarkerFunc *marker)
 Mark sight changes. More...
 
void UpdateFogOfWarChange ()
 Update fog of war. More...
 
void MapFixSeenWallTile (const Vec2i &pos)
 Correct the seen wall field, depending on the surrounding. More...
 
void MapFixSeenWallNeighbors (const Vec2i &pos)
 Correct the surrounding seen wall fields. More...
 
void MapFixWallTile (const Vec2i &pos)
 Correct the real wall field, depending on the surrounding. More...
 
void SetTile (unsigned int tile, const Vec2i &pos, int value=0)
 Set a tile. More...
 
void SetTile (unsigned int tile, int x, int y, int value=0)
 
void MapCclRegister ()
 register ccl features More...
 
int SaveStratagusMap (const std::string &filename, CMap &map, int writeTerrain, Vec2i newSize={0, 0}, Vec2i offset={0, 0})
 Save a stratagus map (smp format) More...
 
bool LoadStratagusMapInfo (const std::string &mapname)
 Load map presentation. More...
 
bool CheckedCanMoveToMask (const Vec2i &pos, int mask)
 Returns true, if the unit-type(mask can enter field with bounds check. More...
 
bool UnitTypeCanBeAt (const CUnitType &type, const Vec2i &pos)
 Returns true, if the unit-type can enter the field. More...
 
bool UnitCanBeAt (const CUnit &unit, const Vec2i &pos)
 Returns true, if the unit can enter the field. More...
 
void PreprocessMap ()
 Preprocess map, for internal use. More...
 
void MapMarkUnitSight (CUnit &unit)
 Mark on vision table the Sight of the unit. More...
 
void MapUnmarkUnitSight (CUnit &unit)
 Unmark on vision table the Sight of the unit. More...
 
void MapRefreshUnitsSight (const Vec2i &tilePos, const bool resetSight=false)
 Mark/Unmark on vision table the Sight for the units around the tilePos. More...
 
void MapRefreshUnitsSight (const bool resetSight=false)
 Mark/Unmark on vision table the Sight for all units on the map. More...
 
bool CanMoveToMask (const Vec2i &pos, int mask)
 Can a unit with 'mask' enter the field. More...
 
void MapMarkRadar (const CPlayer &player, const CUnit &unit, const Vec2i &pos, int w, int h, int range)
 Handle Marking and Unmarking of radar vision. More...
 
void MapUnmarkRadar (const CPlayer &player, const CUnit &unit, const Vec2i &pos, int w, int h, int range)
 
void MapMarkRadarJammer (const CPlayer &player, const CUnit &unit, const Vec2i &pos, int w, int h, int range)
 Handle Marking and Unmarking of radar vision. More...
 
void MapUnmarkRadarJammer (const CPlayer &player, const CUnit &unit, const Vec2i &pos, int w, int h, int range)
 

Macro Definition Documentation

◆ MaxMapHeight

#define MaxMapHeight   256

◆ MaxMapWidth

#define MaxMapWidth   256

Typedef Documentation

◆ MapMarkerFunc

typedef void MapMarkerFunc(const CPlayer &player, const unsigned int index)

Function to (un)mark the vision table.

Function Documentation

◆ CanMoveToMask()

bool CanMoveToMask ( const Vec2i pos,
int  mask 
)
inline

Can a unit with 'mask' enter the field.

◆ CheckedCanMoveToMask()

bool CheckedCanMoveToMask ( const Vec2i pos,
int  mask 
)

Returns true, if the unit-type(mask can enter field with bounds check.

Can move to this point, applying mask.

Parameters
posmap tile position.
maskMask for movement to apply.
Returns
True if could be entered, false otherwise.

◆ LoadStratagusMapInfo()

bool LoadStratagusMapInfo ( const std::string &  mapname)

Load map presentation.

Load the map presentation

Parameters
mapnamemap filename
Returns
true on successful load, else false

◆ MapCclRegister()

void MapCclRegister ( )

register ccl features

Register CCL features for map.

◆ MapFixSeenWallNeighbors()

void MapFixSeenWallNeighbors ( const Vec2i pos)

Correct the surrounding seen wall fields.

Correct the surrounding seen wall fields.

Parameters
posMap tile-position.

◆ MapFixSeenWallTile()

void MapFixSeenWallTile ( const Vec2i pos)

Correct the seen wall field, depending on the surrounding.

Correct the seen wall field, depending on the surrounding.

Parameters
posMap tile-position.

◆ MapFixWallTile()

void MapFixWallTile ( const Vec2i pos)

Correct the real wall field, depending on the surrounding.

Correct the real wall field, depending on the surrounding.

Parameters
posMap tile-position.

◆ MapFogFilterFlags() [1/2]

int MapFogFilterFlags ( CPlayer player,
const unsigned int  index,
int  mask 
)

Find out what the tile flags are a tile is covered by fog

Parameters
playerplayer who is doing operation
indexmap location
maskinput mask to filter
Returns
Filtered mask after taking fog into account

◆ MapFogFilterFlags() [2/2]

int MapFogFilterFlags ( CPlayer player,
const Vec2i pos,
int  mask 
)

Filter map flags through fog.

◆ MapMarkRadar()

void MapMarkRadar ( const CPlayer player,
const CUnit unit,
const Vec2i pos,
int  w,
int  h,
int  range 
)
inline

Handle Marking and Unmarking of radar vision.

◆ MapMarkRadarJammer()

void MapMarkRadarJammer ( const CPlayer player,
const CUnit unit,
const Vec2i pos,
int  w,
int  h,
int  range 
)
inline

Handle Marking and Unmarking of radar vision.

◆ MapMarkUnitSight()

void MapMarkUnitSight ( CUnit unit)

Mark on vision table the Sight of the unit.

Mark on vision table the Sight of the unit (and units inside for transporter)

Parameters
unitunit to unmark its vision.
See also
MapUnmarkUnitSight.

◆ MapRefreshUnitsSight() [1/2]

void MapRefreshUnitsSight ( const bool  resetSight)

Mark/Unmark on vision table the Sight for all units on the map.

Mark/Unmark on vision table the Sight for all units on the map

Parameters
resetSightUnmark sight if True, Mark otherwise
See also
MapUnmarkUnitSight/MapMarkUnitSight

◆ MapRefreshUnitsSight() [2/2]

void MapRefreshUnitsSight ( const Vec2i tilePos,
const bool  resetSight 
)

Mark/Unmark on vision table the Sight for the units around the tilePos.

Mark/Unmark on vision table the Sight for the units around the tilePos (and units inside for transporter)

Parameters
tilePosPosition of the tile around which to update units vision for
resetSightUnmark sight if True, Mark otherwise
See also
MapUnmarkUnitSight/MapMarkUnitSight

◆ MapSight()

void MapSight ( const CPlayer player,
const CUnit unit,
const Vec2i pos,
int  w,
int  h,
int  range,
MapMarkerFunc marker 
)

Mark sight changes.

Mark the sight of unit. (Explore and make visible.)

Parameters
playerplayer to mark the sight for (not unit owner)
poslocation to mark
wwidth to mark, in square
hheight to mark, in square
rangeRadius to mark.
markerFunction to mark or unmark sight

◆ MapUnmarkRadar()

void MapUnmarkRadar ( const CPlayer player,
const CUnit unit,
const Vec2i pos,
int  w,
int  h,
int  range 
)
inline

◆ MapUnmarkRadarJammer()

void MapUnmarkRadarJammer ( const CPlayer player,
const CUnit unit,
const Vec2i pos,
int  w,
int  h,
int  range 
)
inline

◆ MapUnmarkUnitSight()

void MapUnmarkUnitSight ( CUnit unit)

Unmark on vision table the Sight of the unit.

Unmark on vision table the Sight of the unit (and units inside for transporter)

Parameters
unitunit to unmark its vision.
See also
MapMarkUnitSight.

◆ PreprocessMap()

void PreprocessMap ( )

Preprocess map, for internal use.

Fixes initially the wood and seen tiles.

◆ SaveStratagusMap()

int SaveStratagusMap ( const std::string &  mapName,
CMap map,
int  writeTerrain,
Vec2i  newSize,
Vec2i  offset 
)

Save a stratagus map (smp format)

Save a Stratagus map.

Parameters
mapNamemap filename
mapmap to save
writeTerrainwrite the tiles map in the .sms

◆ SetTile() [1/2]

void SetTile ( unsigned int  tileIndex,
const Vec2i pos,
int  value 
)

Set a tile.

Set a tile

Parameters
tileIndexTile number
poscoordinate
valueValue of the tile

◆ SetTile() [2/2]

void SetTile ( unsigned int  tile,
int  x,
int  y,
int  value = 0 
)
inline

◆ UnitCanBeAt()

bool UnitCanBeAt ( const CUnit unit,
const Vec2i pos 
)

Returns true, if the unit can enter the field.

Can a unit be placed to this point.

Parameters
unitunit to be checked.
posmap tile position.
Returns
True if could be placeded, false otherwise.

◆ UnitTypeCanBeAt()

bool UnitTypeCanBeAt ( const CUnitType type,
const Vec2i pos 
)

Returns true, if the unit-type can enter the field.

Can a unit of unit-type be placed at this point.

Parameters
typeunit-type to be checked.
posmap tile position.
Returns
True if could be entered, false otherwise.

◆ UpdateFogOfWarChange()

void UpdateFogOfWarChange ( )

Update fog of war.

Update fog of war.

Variable Documentation

◆ CurrentMapPath

char CurrentMapPath[1024]

The current map.

The current map.

◆ FlagRevealMap

MapRevealModes FlagRevealMap

Flag must reveal the map.

Flag must reveal the map.

◆ ForestRegeneration

unsigned int ForestRegeneration

Path to the current map.

Forest regeneration

Path to the current map.

◆ ForestRegenerationFrequency

int ForestRegenerationFrequency

Forest regeneration.

◆ Map

CMap Map

◆ MapMarkTileDetectCloak

MapMarkerFunc MapMarkTileDetectCloak

Mark a tile for cloak detection.

◆ MapMarkTileRadar

MapMarkerFunc MapMarkTileRadar

Mark a tile as radar visible, or incrase radar vision.

◆ MapMarkTileRadarJammer

MapMarkerFunc MapMarkTileRadarJammer

Mark a tile as radar jammed, or incrase radar jamming'ness.

◆ MapMarkTileSight

MapMarkerFunc MapMarkTileSight

Mark a tile for normal sight.

◆ MapUnmarkTileDetectCloak

MapMarkerFunc MapUnmarkTileDetectCloak

Unmark a tile for cloak detection.

◆ MapUnmarkTileRadar

MapMarkerFunc MapUnmarkTileRadar

Unmark a tile as radar visible, decrease is visible by other radar.

◆ MapUnmarkTileRadarJammer

MapMarkerFunc MapUnmarkTileRadarJammer

Unmark a tile as jammed, decrease is jamming'ness.

◆ MapUnmarkTileSight

MapMarkerFunc MapUnmarkTileSight

Unmark a tile for normal sight.

◆ ReplayRevealMap

int ReplayRevealMap

Flag must reveal map when in replay.

Flag must reveal map when in replay.

(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.