_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
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 |
CMapField * | Field (unsigned int index) const |
CMapField * | Field (int x, int y) const |
Get the MapField at location x,y. More... | |
CMapField * | Field (const Vec2i &pos) const |
bool | isInitialized () 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 | |
CMapField * | Fields |
bool | NoFogOfWar |
fields on map More... | |
CTileset * | Tileset |
fog of war disabled More... | |
std::string | TileModelsFileName |
tileset data More... | |
CGraphic * | TileGraphic |
lua filename that loads all tilemodels More... | |
bool | isMapInitialized { false } |
graphic for all the tiles More... | |
CMapInfo | Info |
map.cpp - The map. | |
CMap () | |
~CMap () | |
void | AllocateTileset () |
void | Create () |
Alocate and initialise map table. More... | |
void | Init () |
Build tables for map. More... | |
void | Clean (const bool isHardClean=false) |
Clean the map. More... | |
void | ClearTile (const Vec2i &tilePos) |
Remove wood, rock or wall from the map and update nearby unit's vision if needed. 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 (MapRevealModes mode=MapRevealModes::cKnown) |
Set map reveal mode: hidden/known/fully explored. 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... | |
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:
An array CMap::Info::Width * CMap::Info::Height of all fields belonging to this map.
Flag if true, the fog of war is disabled.
Tileset data for the map. See CTileset. This contains all information about the tile.
Lua filename that loads all tilemodels
Graphic for all the tiles
CMap::FogGraphic
Graphic for fog of war
Descriptive information of the map. See CMapInfo.
CMap::CMap | ( | ) |
CMap::~CMap | ( | ) |
void CMap::AllocateTileset | ( | ) |
void CMap::Clean | ( | const bool | isHardClean = false | ) |
Clean the map.
Cleanup the map module.
Remove wood, rock or wall from the map and update nearby unit's vision if needed.
Remove Wood, Rock or Wall tile from the map It checks if field is opaque and recalc vision for nearby units
tilePos | Map tile-position. |
void CMap::Create | ( | ) |
Alocate and initialise map table.
Alocate and initialise map table
|
inline |
Get the MapField at location x,y.
|
inline |
|
inline |
|
inline |
Wall is hit.
Wall is hit with damage.
pos | Map tile-position of wall. |
damage | Damage 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.
pos | map tile position. |
void CMap::Init | ( | ) |
Build tables for map.
Initialize the fog of war. Build tables, setup functions.
Insert new unit into cache.
Insert new unit into cache.
unit | Unit pointer to place in cache. |
|
inline |
convert map pixelpos coordonates into tilepos
Mark a tile as seen by the player.
Path of the current map.
Marks seen tile – used mainly for the Fog Of War
mf | MapField-position. |
bool CMap::OrcWallOnMap | ( | const Vec2i & | pos | ) | const |
Returns true, if orc wall on the map tile field.
Orc wall on map tile.
pos | map tile position. |
void CMap::RegenerateForest | ( | ) |
Regenerate the forest.
Regenerate forest.
Remove unit from cache.
Remove unit from cache.
unit | Unit pointer to remove from cache. |
Set wall on field.
Remove wall from the map.
pos | Map position. |
FIXME: support more walls of different races.
void CMap::Reveal | ( | MapRevealModes | mode = MapRevealModes::cKnown | ) |
Set map reveal mode: hidden/known/fully explored.
Reveal the entire map.
We can't do "unrevealing" yet
Save the map.
Save the complete map.
file | Output file. |
Set wall on field.
Set wall onto the map.
pos | Map position. |
humanwall | Flag, if true set a human wall. |
Refresh vision of nearby units in case is walls are set as opaque field
Refresh vision of nearby units in case is walls are set as opaque field
convert tilepos coordonates into map pixel pos (take the center of the tile)
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.
pos | map tile position. |
CMapField* CMap::Fields |
CMapInfo CMap::Info |
bool CMap::isMapInitialized { false } |
graphic for all the tiles
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