Otclient  14/8/2020
Map Class Reference

#include <map.h>

Public Member Functions

void init ()
 
void terminate ()
 
void addMapView (const MapViewPtr &mapView)
 
void removeMapView (const MapViewPtr &mapView)
 
void notificateTileUpdate (const Position &pos)
 
bool loadOtcm (const std::string &fileName)
 
void saveOtcm (const std::string &fileName)
 
void loadOtbm (const std::string &fileName)
 
void saveOtbm (const std::string &fileName)
 
void setHouseFile (const std::string &file)
 
void setSpawnFile (const std::string &file)
 
void setDescription (const std::string &desc)
 
void clearDescriptions ()
 
void setWidth (uint16 w)
 
void setHeight (uint16 h)
 
std::string getHouseFile ()
 
std::string getSpawnFile ()
 
Size getSize ()
 
std::vector< std::string > getDescriptions ()
 
void clean ()
 
void cleanDynamicThings ()
 
void cleanTexts ()
 
void addThing (const ThingPtr &thing, const Position &pos, int stackPos=-1)
 
ThingPtr getThing (const Position &pos, int stackPos)
 
bool removeThing (const ThingPtr &thing)
 
bool removeThingByPos (const Position &pos, int stackPos)
 
void colorizeThing (const ThingPtr &thing, const Color &color)
 
void removeThingColor (const ThingPtr &thing)
 
StaticTextPtr getStaticText (const Position &pos)
 
const TilePtrcreateTile (const Position &pos)
 
template<typename... Items>
const TilePtrcreateTileEx (const Position &pos, const Items &... items)
 
const TilePtrgetOrCreateTile (const Position &pos)
 
const TilePtrgetTile (const Position &pos)
 
const TileList getTiles (int floor=-1)
 
void cleanTile (const Position &pos)
 
void setShowZone (tileflags_t zone, bool show)
 
void setShowZones (bool show)
 
void setZoneColor (tileflags_t zone, const Color &color)
 
void setZoneOpacity (float opacity)
 
float getZoneOpacity ()
 
Color getZoneColor (tileflags_t flag)
 
tileflags_t getZoneFlags ()
 
bool showZones ()
 
bool showZone (tileflags_t zone)
 
void setForceShowAnimations (bool force)
 
bool isForcingAnimations ()
 
bool isShowingAnimations ()
 
void setShowAnimations (bool show)
 
void beginGhostMode (float opacity)
 
void endGhostMode ()
 
std::map< Position, ItemPtrfindItemsById (uint16 clientId, uint32 max)
 
void addCreature (const CreaturePtr &creature)
 
CreaturePtr getCreatureById (uint32 id)
 
void removeCreatureById (uint32 id)
 
std::vector< CreaturePtrgetSightSpectators (const Position &centerPos, bool multiFloor)
 
std::vector< CreaturePtrgetSpectators (const Position &centerPos, bool multiFloor)
 
std::vector< CreaturePtrgetSpectatorsInRange (const Position &centerPos, bool multiFloor, int xRange, int yRange)
 
std::vector< CreaturePtrgetSpectatorsInRangeEx (const Position &centerPos, bool multiFloor, int minXRange, int maxXRange, int minYRange, int maxYRange)
 
void setLight (const Light &light)
 
void setCentralPosition (const Position &centralPosition)
 
bool isLookPossible (const Position &pos)
 
bool isCovered (const Position &pos, int firstFloor=0)
 
bool isCompletelyCovered (const Position &pos, int firstFloor=0)
 
bool isAwareOfPosition (const Position &pos)
 
void setAwareRange (const AwareRange &range)
 
void resetAwareRange ()
 
AwareRange getAwareRange ()
 
Light getLight ()
 
Position getCentralPosition ()
 
int getFirstAwareFloor ()
 
int getLastAwareFloor ()
 
const std::vector< MissilePtr > & getFloorMissiles (int z)
 
std::vector< AnimatedTextPtrgetAnimatedTexts ()
 
std::vector< StaticTextPtrgetStaticTexts ()
 
std::tuple< std::vector< Otc::Direction >, Otc::PathFindResultfindPath (const Position &start, const Position &goal, int maxComplexity, int flags=0)
 

Detailed Description

Definition at line 139 of file map.h.

Member Function Documentation

◆ addCreature()

void Map::addCreature ( const CreaturePtr creature)

Definition at line 466 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMapView()

void Map::addMapView ( const MapViewPtr mapView)

Definition at line 50 of file map.cpp.

Here is the caller graph for this function:

◆ addThing()

void Map::addThing ( const ThingPtr thing,
const Position pos,
int  stackPos = -1 
)

Definition at line 107 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ beginGhostMode()

void Map::beginGhostMode ( float  opacity)

Definition at line 432 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean()

void Map::clean ( )

Definition at line 72 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanDynamicThings()

void Map::cleanDynamicThings ( )

Definition at line 87 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanTexts()

void Map::cleanTexts ( )

Definition at line 101 of file map.cpp.

Here is the caller graph for this function:

◆ cleanTile()

void Map::cleanTile ( const Position pos)

Definition at line 350 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearDescriptions()

void Map::clearDescriptions ( )
inline

Definition at line 160 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ colorizeThing()

void Map::colorizeThing ( const ThingPtr thing,
const Color color 
)

Definition at line 219 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createTile()

const TilePtr & Map::createTile ( const Position pos)

Definition at line 265 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createTileEx()

template<typename... Items>
const TilePtr & Map::createTileEx ( const Position pos,
const Items &...  items 
)

Definition at line 282 of file map.cpp.

Here is the call graph for this function:

◆ endGhostMode()

void Map::endGhostMode ( )

Definition at line 437 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findItemsById()

std::map< Position, ItemPtr > Map::findItemsById ( uint16  clientId,
uint32  max 
)

Definition at line 442 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findPath()

std::tuple< std::vector< Otc::Direction >, Otc::PathFindResult > Map::findPath ( const Position start,
const Position goal,
int  maxComplexity,
int  flags = 0 
)

Definition at line 715 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAnimatedTexts()

std::vector<AnimatedTextPtr> Map::getAnimatedTexts ( )
inline

Definition at line 241 of file map.h.

Here is the caller graph for this function:

◆ getAwareRange()

AwareRange Map::getAwareRange ( )
inline

Definition at line 233 of file map.h.

Here is the caller graph for this function:

◆ getCentralPosition()

Position Map::getCentralPosition ( )
inline

Definition at line 236 of file map.h.

Here is the caller graph for this function:

◆ getCreatureById()

CreaturePtr Map::getCreatureById ( uint32  id)

Definition at line 471 of file map.cpp.

Here is the caller graph for this function:

◆ getDescriptions()

std::vector<std::string> Map::getDescriptions ( )
inline

Definition at line 167 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFirstAwareFloor()

int Map::getFirstAwareFloor ( )

Definition at line 699 of file map.cpp.

Here is the caller graph for this function:

◆ getFloorMissiles()

const std::vector<MissilePtr>& Map::getFloorMissiles ( int  z)
inline

Definition at line 239 of file map.h.

Here is the caller graph for this function:

◆ getHouseFile()

std::string Map::getHouseFile ( )
inline

Definition at line 164 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLastAwareFloor()

int Map::getLastAwareFloor ( )

Definition at line 707 of file map.cpp.

Here is the caller graph for this function:

◆ getLight()

Light Map::getLight ( )
inline

Definition at line 235 of file map.h.

Here is the caller graph for this function:

◆ getOrCreateTile()

const TilePtr & Map::getOrCreateTile ( const Position pos)

Definition at line 294 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSightSpectators()

std::vector< CreaturePtr > Map::getSightSpectators ( const Position centerPos,
bool  multiFloor 
)

Definition at line 569 of file map.cpp.

Here is the call graph for this function:

◆ getSize()

Size Map::getSize ( )
inline

Definition at line 166 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSpawnFile()

std::string Map::getSpawnFile ( )
inline

Definition at line 165 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSpectators()

std::vector< CreaturePtr > Map::getSpectators ( const Position centerPos,
bool  multiFloor 
)

Definition at line 574 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSpectatorsInRange()

std::vector< CreaturePtr > Map::getSpectatorsInRange ( const Position centerPos,
bool  multiFloor,
int  xRange,
int  yRange 
)

Definition at line 579 of file map.cpp.

Here is the call graph for this function:

◆ getSpectatorsInRangeEx()

std::vector< CreaturePtr > Map::getSpectatorsInRangeEx ( const Position centerPos,
bool  multiFloor,
int  minXRange,
int  maxXRange,
int  minYRange,
int  maxYRange 
)

Definition at line 584 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStaticText()

StaticTextPtr Map::getStaticText ( const Position pos)

Definition at line 255 of file map.cpp.

◆ getStaticTexts()

std::vector<StaticTextPtr> Map::getStaticTexts ( )
inline

Definition at line 242 of file map.h.

Here is the caller graph for this function:

◆ getThing()

ThingPtr Map::getThing ( const Position pos,
int  stackPos 
)

Definition at line 170 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTile()

const TilePtr & Map::getTile ( const Position pos)

Definition at line 310 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTiles()

const TileList Map::getTiles ( int  floor = -1)

Definition at line 320 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getZoneColor()

Color Map::getZoneColor ( tileflags_t  flag)

Definition at line 396 of file map.cpp.

Here is the caller graph for this function:

◆ getZoneFlags()

tileflags_t Map::getZoneFlags ( )
inline

Definition at line 200 of file map.h.

◆ getZoneOpacity()

float Map::getZoneOpacity ( )
inline

Definition at line 198 of file map.h.

Here is the caller graph for this function:

◆ init()

void Map::init ( )

Definition at line 39 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAwareOfPosition()

bool Map::isAwareOfPosition ( const Position pos)

Definition at line 659 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCompletelyCovered()

bool Map::isCompletelyCovered ( const Position pos,
int  firstFloor = 0 
)

Definition at line 634 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCovered()

bool Map::isCovered ( const Position pos,
int  firstFloor = 0 
)

Definition at line 621 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isForcingAnimations()

bool Map::isForcingAnimations ( )

Definition at line 413 of file map.cpp.

Here is the caller graph for this function:

◆ isLookPossible()

bool Map::isLookPossible ( const Position pos)

Definition at line 615 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isShowingAnimations()

bool Map::isShowingAnimations ( )

Definition at line 418 of file map.cpp.

Here is the caller graph for this function:

◆ loadOtbm()

void Map::loadOtbm ( const std::string &  fileName)

Definition at line 35 of file mapio.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadOtcm()

bool Map::loadOtcm ( const std::string &  fileName)

Definition at line 397 of file mapio.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notificateTileUpdate()

void Map::notificateTileUpdate ( const Position pos)

Definition at line 62 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeCreatureById()

void Map::removeCreatureById ( uint32  id)

Definition at line 479 of file map.cpp.

Here is the caller graph for this function:

◆ removeMapView()

void Map::removeMapView ( const MapViewPtr mapView)

Definition at line 55 of file map.cpp.

Here is the caller graph for this function:

◆ removeThing()

bool Map::removeThing ( const ThingPtr thing)

Definition at line 177 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeThingByPos()

bool Map::removeThingByPos ( const Position pos,
int  stackPos 
)

Definition at line 212 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeThingColor()

void Map::removeThingColor ( const ThingPtr thing)

Definition at line 237 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetAwareRange()

void Map::resetAwareRange ( )

Definition at line 689 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveOtbm()

void Map::saveOtbm ( const std::string &  fileName)

Usually when a map has empty house/spawn file it means the map is new. TODO: Ask the user for a map name instead of those ugly uses of substr

we only need the filename to save to, the directory should be resolved by the OTBM loader not here

OTBM_TILE_AREA

Definition at line 231 of file mapio.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveOtcm()

void Map::saveOtcm ( const std::string &  fileName)

Definition at line 474 of file mapio.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAwareRange()

void Map::setAwareRange ( const AwareRange range)

Definition at line 683 of file map.cpp.

Here is the caller graph for this function:

◆ setCentralPosition()

void Map::setCentralPosition ( const Position centralPosition)

Definition at line 534 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDescription()

void Map::setDescription ( const std::string &  desc)
inline

Definition at line 158 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setForceShowAnimations()

void Map::setForceShowAnimations ( bool  force)

Definition at line 404 of file map.cpp.

Here is the caller graph for this function:

◆ setHeight()

void Map::setHeight ( uint16  h)
inline

Definition at line 162 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHouseFile()

void Map::setHouseFile ( const std::string &  file)
inline

Definition at line 156 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLight()

void Map::setLight ( const Light light)
inline

Definition at line 223 of file map.h.

◆ setShowAnimations()

void Map::setShowAnimations ( bool  show)

Definition at line 423 of file map.cpp.

Here is the caller graph for this function:

◆ setShowZone()

void Map::setShowZone ( tileflags_t  zone,
bool  show 
)

Definition at line 374 of file map.cpp.

Here is the caller graph for this function:

◆ setShowZones()

void Map::setShowZones ( bool  show)

Definition at line 382 of file map.cpp.

Here is the caller graph for this function:

◆ setSpawnFile()

void Map::setSpawnFile ( const std::string &  file)
inline

Definition at line 157 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setWidth()

void Map::setWidth ( uint16  w)
inline

Definition at line 161 of file map.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setZoneColor()

void Map::setZoneColor ( tileflags_t  zone,
const Color color 
)

Definition at line 390 of file map.cpp.

Here is the caller graph for this function:

◆ setZoneOpacity()

void Map::setZoneOpacity ( float  opacity)
inline

Definition at line 196 of file map.h.

Here is the caller graph for this function:

◆ showZone()

bool Map::showZone ( tileflags_t  zone)
inline

Definition at line 202 of file map.h.

Here is the caller graph for this function:

◆ showZones()

bool Map::showZones ( )
inline

Definition at line 201 of file map.h.

Here is the caller graph for this function:

◆ terminate()

void Map::terminate ( )

Definition at line 45 of file map.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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