____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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"
#include <map.h>
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. | |
| CMapField * | Field (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 | |
| CMapField * | Fields |
| 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 CGraphic * | FogGraphic |
| graphic for fog of war | |
#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.
Graphic for fog of war
Descriptive information of the map. See CMapInfo.
Definition at line 205 of file map.h.
| 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.
| player | Player to check for. | |
| x | X tile to check. | |
| y | Y tile to check. |
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 | ) |
Save the map.
Reveal the entire map.
Definition at line 74 of file map.cpp.
References Field(), Info, CMapInfo::MapHeight, CMapInfo::MapWidth, NumUnits, PlayerMax, PlayerNeutral, PlayerNobody, Players, CUnit::Type, UnitCountSeen(), UnitGoesOutOfFog(), UnitGoesUnderFog(), Units, CMapField::Visible, Visible, and y.
Referenced by CclRevealMap(), and CreateGame().
| void CMap::Save | ( | CFile * | file | ) | const |
Get the MapField at location x,y.
Save the complete map.
| file | Output file. |
Definition at line 54 of file map_save.cpp.
References CMapInfo::Description, Field(), CMapInfo::Filename, CMapField::Flags, Info, MapFieldAirUnit, MapFieldBuilding, MapFieldCoastAllowed, MapFieldLandAllowed, MapFieldLandUnit, MapFieldNoBuilding, MapFieldSeaUnit, MapFieldUnpassable, MapFieldWaterAllowed, CMapInfo::MapHeight, CMapInfo::MapWidth, NoFogOfWar, PatchManager, PlayerMax, CFile::printf(), CPatchManager::savePatches(), StratagusFormatArgs, StratagusFormatString, StratagusVersion, and CMapField::Visible.
Referenced by SaveGame().
| CMapField* CMap::Field | ( | int | x, | |
| int | y | |||
| ) | const [inline] |
Definition at line 238 of file map.h.
References Fields, Info, and CMapInfo::MapWidth.
Referenced by AiCheckSurrounding(), CanBuildHere(), CanBuildOn(), CanMoveToMask(), CheckedCanMoveToMask(), CoastOnMap(), CommandSharedVision(), CostMoveTo(), DoActionMove(), IsTileRadarVisible(), IsTileVisible(), MapMarkTileRadar(), MapMarkTileRadarJammer(), MapMarkTileSight(), MapUnmarkTileRadar(), MapUnmarkTileRadarJammer(), MapUnmarkTileSight(), MarkUnitFieldFlags(), Reveal(), Save(), UnitCountSeen(), UnmarkUnitFieldFlags(), and WaterOnMap().
| 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.
| tx | X map tile position. | |
| ty | Y map tile position. |
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.
| tx | X map tile position. | |
| ty | Y map tile position. |
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().
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().
| bool CMap::NoFogOfWar |
fog of war disabled
Definition at line 259 of file map.h.
Referenced by ApplyReplaySettings(), CclGetFogOfWar(), CclSetFogOfWar(), CclStratagusMap(), Clean(), CEditor::Init(), IsTileVisible(), MapMarkTileSight(), MapUnmarkTileSight(), Save(), and UnitCountSeen().
CGraphic * CMap::FogGraphic [static] |
graphic for fog of war
Definition at line 261 of file map.h.
Referenced by CclSetFogOfWarGraphics(), CleanFogOfWar(), and DrawFogOfWarTile().
Definition at line 263 of file map.h.
Referenced by PatchSaveButtonListener::action(), Clean(), CreatePatchIcons(), CViewport::DrawMapBackgroundInViewport(), EditorCallbackButtonDown(), EditorCallbackKeyDown(), EditorCallbackMouse(), Init(), PatchEditorMainLoop(), Save(), StartPatchEditor(), CMinimap::UpdateTerrain(), and WriteMapSetup().
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().
1.5.6