____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

CMap Class Reference

< Describes the world map More...

#include <map.h>

List of all members.

Public Member Functions

void Create ()
 < Alocate and initialise map table.
void Init ()
 Clean the map.
void Clean ()
 Cleanup memory for fog of war tables.
void CleanFogOfWar ()
 Find if a tile is visible (with shared vision).
unsigned short IsTileVisible (const CPlayer *player, int x, int y) const
 Check if a field for the user is explored.
bool IsFieldExplored (const CPlayer *player, int x, int y) const
 Check if a field for the user is visible.
bool IsFieldVisible (const CPlayer *player, int x, int y) const
 Reveal the complete map, make everything known.
void Reveal (void)
 Save the map.
void Save (CFile *file) const
 Get the MapField at location x,y.
CMapFieldField (int x, int y) const
bool WaterOnMap (int x, int y) const
 < Returns true, if water on the map tile field
bool CoastOnMap (int x, int y) const

Public Attributes

CMapFieldFields
 fields on map
unsigned * Visible [PlayerMax]
 visible bit-field
bool NoFogOfWar
 fog of war disabled
CPatchManager PatchManager
CMapInfo Info
 descriptive information

Static Public Attributes

static CGraphicFogGraphic
 graphic for fog of war


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::FogGraphic

Graphic for fog of war

CMap::Info

Descriptive information of the map. See CMapInfo.

Definition at line 205 of file map.h.


Member Function Documentation

void CMap::Create (  ) 

< Alocate and initialise map table.

Build tables for map

Alocate and initialize map table

Definition at line 227 of file map.cpp.

References Assert, Fields, Info, CUnitCache::Init(), CMapInfo::MapHeight, CMapInfo::MapWidth, UnitCache, and Visible.

Referenced by LoadMap().

void CMap::Init (  ) 

Clean the map.

Initialize the map

Definition at line 218 of file map.cpp.

References CPatchManager::load(), and PatchManager.

Referenced by CreateGame(), and InitModules().

void CMap::Clean ( void   ) 

Cleanup memory for fog of war tables.

Cleanup the map module.

Definition at line 240 of file map.cpp.

References CPatchManager::clear(), CMinimap::Destroy(), Fields, FlagRevealMap, FreeMapInfo(), Info, CUserInterface::Minimap, NoFogOfWar, PatchManager, ReplayRevealMap, UI, and Visible.

Referenced by CleanGame(), and CleanModules().

void CMap::CleanFogOfWar (  ) 

Find if a tile is visible (with shared vision).

Cleanup the fog of war.

Definition at line 636 of file map_fog.cpp.

References FogGraphic, CGraphic::Free(), Map, OnlyFogSurface, UseOpenGL, and VisibleTable.

Referenced by CleanModules().

unsigned short CMap::IsTileVisible ( const CPlayer player,
int  x,
int  y 
) const

Check if a field for the user is explored.

Find out if a field is seen (By player, or by shared vision) This function will return > 1 with no fog of war.

Parameters:
player Player to check for.
x X tile to check.
y Y tile to check.
Returns:
0 unexplored, 1 explored, > 1 visible.

Definition at line 81 of file map_fog.cpp.

References Field(), CPlayer::Index, NoFogOfWar, PlayerMax, Players, CPlayer::SharedVision, and CMapField::Visible.

Referenced by CViewport::DrawMapFogOfWar(), IsFieldExplored(), IsFieldVisible(), and CMinimap::Update().

bool CMap::IsFieldExplored ( const CPlayer player,
int  x,
int  y 
) const [inline]

Check if a field for the user is visible.

Definition at line 222 of file map.h.

References IsTileVisible().

Referenced by AiSendExplorers(), CanBuildUnitType(), CostMoveTo(), DrawBuildingCursor(), UIHandleButtonDown(), UIHandleMouseMove(), and UnitFindResource().

bool CMap::IsFieldVisible ( const CPlayer player,
int  x,
int  y 
) const [inline]

Reveal the complete map, make everything known.

Definition at line 227 of file map.h.

References IsTileVisible().

Referenced by DoActionMove(), MissileVisibleInViewport(), and UIHandleButtonUp().

void CMap::Reveal ( void   ) 

void CMap::Save ( CFile file  )  const

CMapField* CMap::Field ( int  x,
int  y 
) const [inline]

bool CMap::WaterOnMap ( int  tx,
int  ty 
) const

< Returns true, if water on the map tile field

Returns true, if coast on the map tile field

Water on map tile.

Parameters:
tx X map tile position.
ty Y map tile position.
Returns:
True if water, false otherwise.

Definition at line 122 of file map.cpp.

References Assert, Field(), Info, MapFieldWaterAllowed, CMapInfo::MapHeight, and CMapInfo::MapWidth.

Referenced by DoActionMove().

bool CMap::CoastOnMap ( int  tx,
int  ty 
) const

Coast on map tile.

Parameters:
tx X map tile position.
ty Y map tile position.
Returns:
True if coast, false otherwise.

Definition at line 136 of file map.cpp.

References Assert, Field(), Info, MapFieldCoastAllowed, CMapInfo::MapHeight, and CMapInfo::MapWidth.

Referenced by ClosestFreeCoast(), DoActionMove(), and CButtonPanel::DoClicked().


Member Data Documentation

fields on map

Definition at line 256 of file map.h.

Referenced by CclRevealMap(), CclSetFogOfWar(), CclStratagusMap(), Clean(), Create(), Field(), and CEditor::Init().

unsigned* CMap::Visible[PlayerMax]

visible bit-field

Definition at line 257 of file map.h.

Referenced by CclStratagusMap(), Clean(), Create(), CEditor::Init(), and Reveal().

graphic for fog of war

Definition at line 261 of file map.h.

Referenced by CclSetFogOfWarGraphics(), CleanFogOfWar(), and DrawFogOfWarTile().

descriptive information

Definition at line 265 of file map.h.

Referenced by AiCheckSurrounding(), AiFindBuildingPlace2(), AiFindTarget(), AiMarkWaterTransporter(), AiMoveUnitInTheWay(), AiSendExplorers(), CanBuildHere(), CanBuildOn(), AreaBombardment::Cast(), Demolish::Cast(), CclDefineMapSetup(), CclDefinePlayerTypes(), CclPresentMap(), CclStratagusMap(), CBuildRestrictionAddOn::Check(), CBuildRestrictionDistance::Check(), CheckedCanMoveToMask(), Clean(), ClientParseConnected(), ClipViewport(), ClosestFreeCoast(), CoastOnMap(), CommandAttack(), CommandAttackGround(), CommandMove(), CommandPatrolUnit(), CommandSharedVision(), CommandSpellCast(), CMinimap::Create(), Create(), CreateGame(), DrawFogOfWarTile(), CViewport::DrawMapFogOfWar(), DrawPlayers(), DrawStartLocations(), EditorCallbackButtonDown(), EditorCallbackKeyDown(), EditorCallbackMouse(), Field(), GameTypeLeftVsRight(), GameTypeTopVsBottom(), HandleActionBoard(), HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), HitUnit(), CEditor::Init(), InitMatrix(), InitPathfinder(), InitUserInterface(), CViewport::IsInsideMapArea(), LoadMap(), LoadStratagusMap(), LoadStratagusMapInfo(), MakeMatrix(), MapFogFilterFlags(), MapMarkTileRadar(), MapMarkTileRadarJammer(), MapMarkTileSight(), MapSight(), MapUnmarkTileRadar(), MapUnmarkTileRadarJammer(), MapUnmarkTileSight(), MissileHit(), MoveToTarget(), NetworkGamePrepareGameSettings(), NetworkProcessClientRequest(), NetworkServerStartGame(), NewPath(), Reveal(), Save(), SaveGame(), SaveStratagusMap(), CMinimap::Screen2MapX(), CMinimap::Screen2MapY(), ServerParseMap(), ServerParseState(), ServerParseWaiting(), CViewport::Set(), StartEditor(), StartReplay(), UnitActions(), UnitFindResource(), UpdateUnitVariables(), CViewport::Viewport2MapX(), CViewport::Viewport2MapY(), WaterOnMap(), and WriteMapPresentation().


The documentation for this class was generated from the following files:

Generated on Sat Feb 21 00:28:23 2009 for Bos Wars by  doxygen 1.5.6