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

Public Member Functions | Public Attributes | List of all members
CMapField Class Reference

Describes a field of the map. More...

#include <tile.h>

Public Member Functions

unsigned int getGraphicTile () const
 
unsigned char getCost () const
 
unsigned int getFlag () const
 
void setGraphicTile (unsigned int tile)
 
mapfield.cpp - The map field.
 CMapField ()
 
void Save (CFile &file) const
 
void parse (lua_State *l)
 
void setTileIndex (const CTileset &tileset, unsigned int tileIndex, int value)
 
bool isOpaque () const
 Check if a field is opaque for field of view. More...
 
bool CheckMask (int mask) const
 Check if a field flags. More...
 
bool WaterOnMap () const
 Returns true, if water on the map tile field. More...
 
bool CoastOnMap () const
 Returns true, if coast on the map tile field. More...
 
bool ForestOnMap () const
 Returns true, if water on the map tile field. More...
 
bool Cost4OnMap () const
 Returns true, if any terrain resource giving Cost4 on the map tile field. More...
 
bool Cost5OnMap () const
 Returns true, if any terrain resource giving Cost5 on the map tile field. More...
 
bool Cost6OnMap () const
 Returns true, if any terrain resource giving Cost6 on the map tile field. More...
 
bool RockOnMap () const
 Returns true, if coast on the map tile field. More...
 
bool isDecorative () const
 Returns true if the field should not need mixing with the surroundings. More...
 
bool isAWall () const
 
bool isHuman () const
 
bool isAHumanWall () const
 
bool isAOrcWall () const
 
bool IsTerrainResourceOnMap (int resource) const
 
bool IsTerrainResourceOnMap () const
 

Public Attributes

unsigned int Flags
 graphic tile number More...
 
unsigned int Value
 unit cost to move in this tile More...
 
CUnitCache UnitCache
 HP for walls/Wood Regeneration, value of stored resource for forest or harvestable terrain. More...
 
CMapFieldPlayerInfo playerInfo
 A unit on the map field. More...
 

Detailed Description

Describes a field of the map.

#include "tile.h"

CMapFieldPlayerInfo::SeenTile

This is the tile number, that the player sitting on the computer currently knows. Idea: Can be uses for illusions.

CMapFieldPlayerInfo::Visible[]

Counter how many units of the player can see this field. 0 the field is not explored, 1 explored, n-1 unit see it. Currently no more than 253 units can see a field.

CMapFieldPlayerInfo::VisCloak[]

Visiblity for cloaking.

CMapFieldPlayerInfo::Radar[]

Visiblity for radar.

CMapFieldPlayerInfo::RadarJammer[]

Jamming capabilities.

#include "tile.h"

This class contains all information about a field on map. It contains its look, properties and content.

The map-field class members:

CMapField::Tile

Tile is number defining the graphic image display for the map-field. 65535 different tiles are supported. A tile is currently 32x32 pixels. In the future is planned to support animated tiles.

CMapField::Flags

Contains special information of that tile. What units are on this field, what units could be placed on this field.

This is the list of all flags currently used:

::MapFieldVisible field is visible. ::MapFieldExplored field is explored. MapFieldHuman human player is the owner of the field used for walls. MapFieldLandAllowed land units are allowed. MapFieldCoastAllowed coast units (transporter) and coast buildings (shipyard) are allowed. MapFieldWaterAllowed water units allowed. MapFieldNoBuilding no buildings allowed. MapFieldUnpassable field is movement blocked. MapFieldWall field contains wall. MapFieldRocks field contains rocks. MapFieldForest field contains forest or other harvestable resource MapFieldLandUnit land unit on field. MapFieldAirUnit air unit on field. MapFieldSeaUnit water unit on field. MapFieldBuilding building on field.

Note: We want to add support for more unit-types like under ground units.

CMapField::Cost

Unit cost to move in this tile.

CMapField::Value

Extra value for each tile. This currently only used for walls, contains the remaining hit points of the wall and for forest, contains the frames until they grow.

CMapField::UnitCache

Contains a vector of all units currently on this field. Note: currently units are only inserted at the insert point. This means units of the size of 2x2 fields are inserted at the top and right most map coordinate.

Constructor & Destructor Documentation

◆ CMapField()

CMapField::CMapField ( )

Member Function Documentation

◆ CheckMask()

bool CMapField::CheckMask ( int  mask) const

Check if a field flags.

◆ CoastOnMap()

bool CMapField::CoastOnMap ( ) const

Returns true, if coast on the map tile field.

◆ Cost4OnMap()

bool CMapField::Cost4OnMap ( ) const

Returns true, if any terrain resource giving Cost4 on the map tile field.

Returns true, if any terrain resource giving Cost4 on the map tile field Cannot use CheckMask, since two bits need to be tested.

◆ Cost5OnMap()

bool CMapField::Cost5OnMap ( ) const

Returns true, if any terrain resource giving Cost5 on the map tile field.

Returns true, if any terrain resource giving Cost5 on the map tile field Cannot use CheckMask, since two bits need to be tested.

◆ Cost6OnMap()

bool CMapField::Cost6OnMap ( ) const

Returns true, if any terrain resource giving Cost6 on the map tile field.

Returns true, if any terrain resource giving Cost6 on the map tile field Cannot use CheckMask, since two bits need to be tested.

◆ ForestOnMap()

bool CMapField::ForestOnMap ( ) const

Returns true, if water on the map tile field.

Returns true, if forest on the map tile field.

◆ getCost()

unsigned char CMapField::getCost ( ) const
inline

◆ getFlag()

unsigned int CMapField::getFlag ( ) const
inline

◆ getGraphicTile()

unsigned int CMapField::getGraphicTile ( ) const
inline

◆ isAHumanWall()

bool CMapField::isAHumanWall ( ) const

◆ isAOrcWall()

bool CMapField::isAOrcWall ( ) const

◆ isAWall()

bool CMapField::isAWall ( ) const

◆ isDecorative()

bool CMapField::isDecorative ( ) const

Returns true if the field should not need mixing with the surroundings.

◆ isHuman()

bool CMapField::isHuman ( ) const

◆ isOpaque()

bool CMapField::isOpaque ( ) const

Check if a field is opaque for field of view.

Check if a field is opaque We check not only MapFieldOpaque flag because some field types (f.e. forest/rock/wall) may be set in the FieldOfView as opaque as well.

◆ IsTerrainResourceOnMap() [1/2]

bool CMapField::IsTerrainResourceOnMap ( ) const

◆ IsTerrainResourceOnMap() [2/2]

bool CMapField::IsTerrainResourceOnMap ( int  resource) const

◆ parse()

void CMapField::parse ( lua_State *  l)

◆ RockOnMap()

bool CMapField::RockOnMap ( ) const

Returns true, if coast on the map tile field.

◆ Save()

void CMapField::Save ( CFile file) const

◆ setGraphicTile()

void CMapField::setGraphicTile ( unsigned int  tile)
inline

◆ setTileIndex()

void CMapField::setTileIndex ( const CTileset tileset,
unsigned int  tileIndex,
int  value 
)

◆ WaterOnMap()

bool CMapField::WaterOnMap ( ) const

Returns true, if water on the map tile field.

Member Data Documentation

◆ Flags

unsigned int CMapField::Flags

graphic tile number

◆ playerInfo

CMapFieldPlayerInfo CMapField::playerInfo

A unit on the map field.

◆ UnitCache

CUnitCache CMapField::UnitCache

HP for walls/Wood Regeneration, value of stored resource for forest or harvestable terrain.

◆ Value

unsigned int CMapField::Value

unit cost to move in this tile


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.