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

       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"

map.cpp File Reference

The map. More...

#include <string.h>
#include "stratagus.h"
#include "unittype.h"
#include "map.h"
#include "minimap.h"
#include "player.h"
#include "unit.h"
#include "unit_cache.h"
#include "ui.h"
#include "script.h"

Go to the source code of this file.

Functions

bool CheckedCanMoveToMask (int x, int y, int mask)
 Returns true, if the unit-type can enter the field.
bool UnitTypeCanBeAt (const CUnitType *type, int x, int y)
 Returns true, if the unit can enter the field.
bool UnitCanBeAt (const CUnit *unit, int x, int y)
void FreeMapInfo (CMapInfo *info)
 Returns true, if the unit-type(mask can enter field with bounds check.
void LoadStratagusMapInfo (const std::string &mapname)
 Release info for a map.

Variables

CMap Map
 The current map.
int FlagRevealMap
 Flag must reveal the map.
int ReplayRevealMap
 Reveal Map is replay.
char CurrentMapPath [1024]
 Path of the current map.
int TileSizeX = 32
 Size of a tile in X.
int TileSizeY = 32
 Size of a tile in Y.


Detailed Description

The map.

Definition in file map.cpp.


Function Documentation

bool CheckedCanMoveToMask ( int  x,
int  y,
int  mask 
)

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

Can move to this point, applying mask.

Parameters:
x X map tile position.
y Y map tile position.
mask Mask for movement to apply.
Returns:
True if could be entered, false otherwise.

Definition at line 152 of file map.cpp.

References CMap::Field(), CMapField::Flags, CMap::Info, CMapInfo::MapHeight, and CMapInfo::MapWidth.

Referenced by FindUnloadPosition(), and UnitTypeCanBeAt().

void FreeMapInfo ( CMapInfo info  ) 

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

Release info about a map.

Parameters:
info CMapInfo pointer.

Definition at line 203 of file map.cpp.

References CMapInfo::Description, CMapInfo::Filename, CMapInfo::MapHeight, CMapInfo::MapUID, CMapInfo::MapWidth, CMapInfo::PlayerSide, and CMapInfo::PlayerType.

Referenced by CMap::Clean().

void LoadStratagusMapInfo ( const std::string &  mapname  ) 

Release info for a map.

Load the map presentation

Parameters:
mapname map filename

Definition at line 268 of file map.cpp.

References CMapInfo::Filename, CMap::Info, and LuaLoadFile().

Referenced by ClientParseConnected(), and LoadMap().

bool UnitCanBeAt ( const CUnit unit,
int  x,
int  y 
)

Can a unit be placed to this point.

Parameters:
unit unit to be checked.
x X map tile position.
y Y map tile position.
Returns:
True if could be placeded, false otherwise.

Definition at line 192 of file map.cpp.

References Assert, CUnit::Type, and UnitTypeCanBeAt().

Referenced by CclCreateUnit(), CclMoveUnit(), DropOutNearest(), DropOutOnSide(), CUnit::MoveToXY(), and NextPathElement().

bool UnitTypeCanBeAt ( const CUnitType type,
int  x,
int  y 
)

Returns true, if the unit can enter the field.

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

Parameters:
type unit-type to be checked.
x X map tile position.
y Y map tile position.
Returns:
True if could be entered, false otherwise.

Definition at line 170 of file map.cpp.

References Assert, CheckedCanMoveToMask(), CUnitType::MovementMask, CUnitType::TileHeight, and CUnitType::TileWidth.

Referenced by Polymorph::Cast(), and UnitCanBeAt().


Variable Documentation

char CurrentMapPath[1024]

Path of the current map.

Path to the current map.

Definition at line 55 of file map.cpp.

Referenced by ApplyReplaySettings(), CclSavedGameInfo(), CreateGame(), CEditor::Init(), SaveGame(), StartEditor(), and StartReplay().

Flag must reveal the map.

Flag must reveal map when in replay.

Definition at line 53 of file map.cpp.

Referenced by ApplyReplaySettings(), CclRevealMap(), CMap::Clean(), CreateGame(), GameMainLoop(), and CEditor::Init().

The current map.

Definition at line 52 of file map.cpp.

Referenced by PatchSaveButtonListener::action(), AiCheckSurrounding(), AiFindBuildingPlace2(), AiFindTarget(), AiMarkWaterTransporter(), AiMoveUnitInTheWay(), AiSendExplorers(), ApplyReplaySettings(), CanBuildHere(), CanBuildOn(), CanBuildUnitType(), AreaBombardment::Cast(), Demolish::Cast(), CclDefineMapSetup(), CclDefinePlayerTypes(), CclGetFogOfWar(), CclPresentMap(), CclRevealMap(), CclSetFogOfWar(), CclStratagusMap(), CBuildRestrictionAddOn::Check(), CBuildRestrictionDistance::Check(), CMap::CleanFogOfWar(), CleanGame(), CleanModules(), ClientParseConnected(), ClipViewport(), ClosestFreeCoast(), CommandAttack(), CommandAttackGround(), CommandMove(), CommandPatrolUnit(), CommandSharedVision(), CommandSpellCast(), CostMoveTo(), CMinimap::Create(), CreateGame(), CreatePatchIcons(), DoActionMove(), CButtonPanel::DoClicked(), DrawBuildingCursor(), DrawFogOfWarTile(), CViewport::DrawMapBackgroundInViewport(), CViewport::DrawMapFogOfWar(), DrawPlayers(), DrawStartLocations(), EditorCallbackButtonDown(), EditorCallbackKeyDown(), EditorCallbackMouse(), EditorSaveMap(), GameTypeLeftVsRight(), GameTypeTopVsBottom(), HandleActionBoard(), HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), HitUnit(), CEditor::Init(), InitMatrix(), InitModules(), InitPathfinder(), InitUserInterface(), CViewport::IsInsideMapArea(), IsTileRadarVisible(), LoadStratagusMap(), MakeMatrix(), MapFogFilterFlags(), MapMarkTileRadar(), MapMarkTileRadarJammer(), MapMarkTileSight(), MapSight(), MapUnmarkTileRadar(), MapUnmarkTileRadarJammer(), MapUnmarkTileSight(), MarkUnitFieldFlags(), MissileHit(), MissileVisibleInViewport(), MoveToTarget(), NetworkGamePrepareGameSettings(), NetworkProcessClientRequest(), NetworkServerStartGame(), NewPath(), PatchEditorMainLoop(), SaveGame(), CMinimap::Screen2MapX(), CMinimap::Screen2MapY(), ServerParseMap(), ServerParseState(), ServerParseWaiting(), CViewport::Set(), StartEditor(), StartMap(), StartPatchEditor(), StartReplay(), tolua_get_Map(), tolua_set_Map(), UIHandleButtonDown(), UIHandleButtonUp(), UIHandleMouseMove(), UnitActions(), UnitCountSeen(), UnitFindResource(), UnmarkUnitFieldFlags(), CMinimap::Update(), CMinimap::UpdateTerrain(), UpdateUnitVariables(), CViewport::Viewport2MapX(), CViewport::Viewport2MapY(), and WriteMapSetup().

int TileSizeX = 32

Size of a tile in X.

Size of a tile in X

Definition at line 60 of file map.cpp.

Referenced by MissilePointToPointBounce::Action(), AddSelectedAirUnitsInRectangle(), AddSelectedGroundUnitsInRectangle(), AddSelectedUnitsInRectangle(), CalculateStereo(), AreaBombardment::Cast(), CclCenterMap(), CclSetFogOfWarGraphics(), CViewport::Center(), CenterOnMessage(), ClipViewport(), CreateGame(), DoActionMove(), DoRightButton(), DoScrollArea(), CUnit::Draw(), DrawBuildingCursor(), DrawConstructionShadow(), DrawCursor(), DrawDecoration(), DrawGrids(), DrawInformations(), DrawMapArea(), CViewport::DrawMapBackgroundInViewport(), DrawMapCursor(), CViewport::DrawMapFogOfWar(), Missile::DrawMissile(), DrawPatchTileIcons(), DrawShadow(), DrawUnitSelection(), DrawUnitType(), EditorCallbackButtonDown(), EditorCallbackMouse(), EvaluateMissileLocation(), FinishViewportModeConfiguration(), FireMissile(), GetColor(), GetMissileMapArea(), GetOrderPosition(), HitUnit(), InitSoundClient(), InitUserInterface(), CViewport::IsInsideMapArea(), CUnit::IsVisibleInViewport(), LetUnitDie(), CViewport::Map2ViewportX(), CViewport::MapPixel2Viewport(), MissileHit(), PatchEditorCallbackMouse(), PlayMissileSound(), SelectAirUnitsInRectangle(), SelectGroundUnitsInRectangle(), SelectSpritesInsideRectangle(), SelectUnitsInRectangle(), SendAttack(), SendAttackGround(), SendMove(), SendPatrol(), SendRepair(), SendResource(), SendSpellCast(), SendUnload(), CViewport::Set(), ShowOrder(), ShowSingleOrder(), UiCenterOnGroup(), UiCenterOnSelected(), UiFindIdleWorker(), UIHandleButtonDown(), UIHandleButtonUp(), UIHandleMouseMove(), UiRecallMapPosition(), UISelectStateButtonDown(), UnitOnScreen(), VideoDrawOnlyFog(), ViewPointDistanceToMissile(), and CViewport::Viewport2MapX().

int TileSizeY = 32

Size of a tile in Y.

Size of a tile in Y

Definition at line 65 of file map.cpp.

Referenced by MissilePointToPointBounce::Action(), AddSelectedAirUnitsInRectangle(), AddSelectedGroundUnitsInRectangle(), AddSelectedUnitsInRectangle(), AreaBombardment::Cast(), CclCenterMap(), CclSetFogOfWarGraphics(), CViewport::Center(), CenterOnMessage(), ClipViewport(), CreateGame(), DoActionMove(), DoRightButton(), DoScrollArea(), CUnit::Draw(), DrawBuildingCursor(), DrawConstructionShadow(), DrawCursor(), DrawDecoration(), DrawGrids(), DrawInformations(), DrawLevelCompare(), DrawMapArea(), CViewport::DrawMapBackgroundInViewport(), DrawMapCursor(), CViewport::DrawMapFogOfWar(), Missile::DrawMissile(), DrawPatchTileIcons(), DrawShadow(), DrawUnitSelection(), DrawUnitType(), EditorCallbackButtonDown(), EditorCallbackMouse(), EvaluateMissileLocation(), FinishViewportModeConfiguration(), FireMissile(), GetColor(), GetMissileMapArea(), GetOrderPosition(), HitUnit(), InitSoundClient(), InitUserInterface(), CViewport::IsInsideMapArea(), CUnit::IsVisibleInViewport(), LetUnitDie(), CViewport::Map2ViewportY(), CViewport::MapPixel2Viewport(), MissileHit(), PatchEditorCallbackMouse(), SelectAirUnitsInRectangle(), SelectGroundUnitsInRectangle(), SelectSpritesInsideRectangle(), SelectUnitsInRectangle(), SendAttack(), SendAttackGround(), SendMove(), SendPatrol(), SendRepair(), SendResource(), SendSpellCast(), SendUnload(), CViewport::Set(), ShowOrder(), ShowSingleOrder(), UiCenterOnGroup(), UiCenterOnSelected(), UiFindIdleWorker(), UIHandleButtonDown(), UIHandleButtonUp(), UIHandleMouseMove(), UiRecallMapPosition(), UISelectStateButtonDown(), UnitOnScreen(), VideoDrawOnlyFog(), ViewPointDistanceToMissile(), and CViewport::Viewport2MapY().


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