HOG2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Map Class Reference

A tile-based representation of the world. More...

#include <Map.h>

Collaboration diagram for Map:
Collaboration graph
[legend]

Public Member Functions

 Map (long width, long height)
 Create a new map of a particular size. More...
 
 Map (const char *filename)
 Create a new map by loading it from a file. More...
 
 Map (Map *)
 Create a new map by copying it from another map. More...
 
 Map (FILE *)
 Create a new map by loading it from a file pointer. More...
 
 Map (std::istringstream &data)
 Not implemented. More...
 
 ~Map ()
 
void Load (const char *filename)
 Resets the current map by loading the file passed in. More...
 
void Load (FILE *f)
 Resets the current map by loading the file from the pointer passed in. More...
 
void setSizeMultipler (int _sizeMultiplier)
 
void Scale (long newWidth, long newHeight)
 
void Trim ()
 
void Save (std::stringstream &data)
 unimplemented. More...
 
void Save (const char *filename)
 Saves the current map out to the designated file. More...
 
void Save (FILE *f)
 Saves the current map out to the designated file. More...
 
MapClone ()
 
const char * GetMapName ()
 
void Print (int scale=1)
 Do an ASCII/ANSI print out of the map. More...
 
long GetMapWidth () const
 return the width of the map More...
 
long GetMapHeight () const
 return the height of the map More...
 
void SetTileSet (tTileset ts)
 Choose the tileset used for land colors. More...
 
tTileset GetTileSet ()
 Get the tileset used for land colors. More...
 
TileGetTile (long x, long y)
 Return the tile at location x, y. More...
 
tSplit GetSplit (long x, long y) const
 Return the split of the tile at x, y. More...
 
void SetSplit (long x, long y, tSplit split)
 Set the split of the tile at x, y. More...
 
long GetTerrainType (long x, long y, tSplitSide split=kWholeTile) const
 Get the terrain type of the (split) tile at x, y. More...
 
long GetTerrainType (long x, long y, tEdge side) const
 Get the terrain type for one side of the tile at x, y. More...
 
void SetTerrainType (int32_t x1, int32_t y1, int32_t x2, int32_t y2, tTerrain t)
 Map::SetTerrainType() More...
 
void SetTerrainType (long x, long y, tTerrain type, tSplitSide split=kWholeTile)
 Set the terrain type of the side of the tile at x, y. More...
 
long GetHeight (long x, long y, tSplitSide split=kWholeTile)
 Get the (flat) height of the tile at x, y. More...
 
void SetHeight (long x, long y, long height, tSplitSide split=kWholeTile)
 Set the (flat) height of the tile at x, y. More...
 
long GetCornerHeight (long x, long y, tCorner which, tEdge edge) const
 Set the height of any one corner of a tile. More...
 
long GetCornerHeight (long x, long y, tCorner which, tSplitSide split=kWholeTile) const
 Get the height of any one corner of a tile. More...
 
void SetCornerHeight (long x, long y, tCorner which, long height, tSplitSide split=kWholeTile)
 Set the height of any one corner of a tile. More...
 
void SmoothSetRectHeight (long x1, long y1, long x2, long y2, long h, tTerrain type=kGround)
 Places a rectangle into the map, but also modifies the edges to make the transition smooth. More...
 
void SetRectHeight (long x1, long y1, long x2, long y2, long h, tTerrain type=kGround)
 Set the height and terrain of a set of tiles. More...
 
bool AdjacentEdges (long x, long y, tEdge edge) const
 Is the tile at x, y adjacent across the edge? More...
 
bool AdjacentCorners (long x, long y, tCorner corner) const
 
bool CanStep (long x1, long y1, long x2, long y2) const
 
void OpenGLDraw (tDisplay how=kPolygons) const
 Does actual OpenGL drawing of the map. More...
 
bool GetOpenGLCoord (int _x, int _y, GLdouble &x, GLdouble &y, GLdouble &z, GLdouble &radius) const
 Get the openGL coordinates of a given tile. More...
 
bool GetOpenGLCoord (float _x, float _y, GLdouble &x, GLdouble &y, GLdouble &z, GLdouble &radius) const
 Get the openGL coordinates of a given tile. More...
 
void GetPointFromCoordinate (point3d loc, int &px, int &py) const
 
double GetCoordinateScale ()
 Returns the scale multiplier between openGL coordinates and map coordinates. More...
 
void SetDrawLand (bool land)
 Toggles whether the land is draw when you call OpenGLDraw. More...
 
bool GetDrawLand ()
 
void DrawTile (Tile *t, int x, int y, tDisplay how) const
 Draw a single tile. More...
 
void DoVertexColor (tTerrain type, int height, bool darken=false) const
 Using OpenGL set the correct color for a particular vertex. More...
 
void DoNormal (tSplit split, halfTile *t, int x, int y) const
 does a rough approximation of the normal for a particular halfTile. More...
 
float GetEdgeWidthX (int x, int y)
 Returns the edge width between (x, y) and (x+1, y) More...
 
float GetEdgeWidthY (int x, int y)
 Returns the edge width between (x, y) and (x, y+1) More...
 
int GetNodeNum (int x, int y, tCorner c=kNone)
 Gets the abstract Graph node number for this tile. More...
 
void SetNodeNum (int num, int x, int y, tCorner c=kNone)
 Sets the abstract Graph node number for this tile. More...
 
int GetRevision ()
 

Private Member Functions

void loadRaw (FILE *f, int height, int width)
 
void loadOctile (FILE *f, int height, int width)
 
void loadOctileCorner (FILE *f, int height, int width)
 
void saveOctile (FILE *f)
 
void saveRaw (FILE *f)
 
bool tryLoadRollingStone (FILE *f)
 
bool tryDragonAge (FILE *f)
 
bool isLegalStone (char c)
 
void paintRoomInside (int x, int y)
 
void drawLandQuickly () const
 

Private Attributes

int width
 
int height
 
Tile ** land
 
bool drawLand
 
GLuint dList
 
bool updated
 
int sizeMultiplier
 
int revision
 
char map_name [128]
 
tMapType mapType
 
tTileset tileSet
 

Detailed Description

A tile-based representation of the world.

Definition at line 142 of file Map.h.

Constructor & Destructor Documentation

◆ Map() [1/5]

Map::Map ( long  _width,
long  _height 
)

Create a new map of a particular size.

A map is an array of tiles according to the height and width of the map.

Definition at line 84 of file Map.cpp.

References dList, drawLand, height, kFall, kOctile, land, map_name, mapType, revision, sizeMultiplier, tileSet, updated, and width.

Referenced by Clone().

◆ Map() [2/5]

Map::Map ( const char *  filename)

Create a new map by loading it from a file.

Creates a new map and initializes it with the file passed to it.

Definition at line 135 of file Map.cpp.

References kFall, land, Load(), sizeMultiplier, and tileSet.

◆ Map() [3/5]

Map::Map ( Map m)

Create a new map by copying it from another map.

Creates a new map and initializes it with the map passed to it.

Definition at line 108 of file Map.cpp.

References dList, drawLand, height, land, map_name, mapType, revision, sizeMultiplier, tileSet, updated, and width.

◆ Map() [4/5]

Map::Map ( FILE *  f)

Create a new map by loading it from a file pointer.

Creates a new map and initializes it with the file pointer passed to it.

Definition at line 148 of file Map.cpp.

References kFall, land, Load(), map_name, sizeMultiplier, and tileSet.

◆ Map() [5/5]

Map::Map ( std::istringstream &  data)

Not implemented.

This function is not implemented.

Definition at line 162 of file Map.cpp.

References dList, kFall, sizeMultiplier, and tileSet.

◆ ~Map()

Map::~Map ( )

Definition at line 169 of file Map.cpp.

References land, and width.

Member Function Documentation

◆ AdjacentCorners()

bool Map::AdjacentCorners ( long  x,
long  y,
tCorner  corner 
) const

◆ AdjacentEdges()

bool Map::AdjacentEdges ( long  x,
long  y,
tEdge  edge 
) const

Is the tile at x, y adjacent across the edge?

given an edge (kInternalEdge, kLeftEdge, kRightEdge, kBottomEdge, kTopEdge) returns whether the tiles on both sides of that edge have a smooth boundary that a unit should be able to cross.

Definition at line 1602 of file Map.cpp.

References GetCornerHeight(), GetSplit(), GetTerrainType(), height, kBackwardSplit, kBottomEdge, kBottomLeft, kBottomRight, kForwardSplit, kInternalEdge, kLeftEdge, kLeftSide, kNoSplit, kRightEdge, kRightSide, kTopEdge, kTopLeft, kTopRight, split(), terrainBits, and width.

Referenced by GraphSearchConstants::AddEdges(), AddMapEdges(), GraphSearchConstants::AddNodesToGraph(), AdjacentCorners(), CanStep(), GetEdgeWidthX(), GetEdgeWidthY(), GetMapGraph(), Scale(), and SharedAMapGroup::UpdateLocation().

◆ CanStep()

bool Map::CanStep ( long  x1,
long  y1,
long  x2,
long  y2 
) const

◆ Clone()

Map* Map::Clone ( )
inline

Definition at line 159 of file Map.h.

References Map().

Referenced by MapEnvironment::MapEnvironment().

◆ DoNormal()

void Map::DoNormal ( tSplit  split,
halfTile t,
int  x,
int  y 
) const

does a rough approximation of the normal for a particular halfTile.

(if I recall, this isn't perfect...)

Definition at line 2224 of file Map.cpp.

References halfTile::corners, height, kBackwardSplit, kForwardSplit, kNoSplit, recVec::normalise(), split(), width, recVec::x, recVec::y, and recVec::z.

Referenced by DrawTile().

◆ DoVertexColor()

void Map::DoVertexColor ( tTerrain  type,
int  vHeight,
bool  darken = false 
) const

Using OpenGL set the correct color for a particular vertex.

calls the appropriate openGL functions to set the draw color according to the tile height/type

Definition at line 2147 of file Map.cpp.

References Colors::blue, Colors::green, kBlight, kFall, kFallTile, kGrass, kGround, kOutOfBounds, kOutOfBounds2, kSwamp, kTrees, kWater, kWinter, Colors::red, and tileSet.

Referenced by DrawTile().

◆ drawLandQuickly()

void Map::drawLandQuickly ( ) const
private

Definition at line 2254 of file Map.cpp.

References GetOpenGLCoord(), GetTerrainType(), height, kGround, and width.

Referenced by OpenGLDraw().

◆ DrawTile()

void Map::DrawTile ( Tile t,
int  x,
int  y,
tDisplay  how 
) const

Draw a single tile.

draws a single tile which is at (x, y) in the land (technically we don't have to pass the tile, we could get it from the x,y coordinates)

Definition at line 1941 of file Map.cpp.

References AdjacentCorners(), halfTile::corners, DoNormal(), DoVertexColor(), GetOpenGLCoord(), kBackwardSplit, kBitmap, kBottomLeft, kBottomRight, kFallTile, kForwardSplit, kGround, kLines, kNoSplit, kOutOfBounds, kPoints, kPolygons, kSwamp, kTopLeft, kTopRight, kTrees, kWater, kWinterTile, Tile::split, Tile::tile1, Tile::tile2, tileSet, halfTile::type, and wall.

Referenced by OpenGLDraw().

◆ GetCoordinateScale()

double Map::GetCoordinateScale ( )

Returns the scale multiplier between openGL coordinates and map coordinates.

If you measure a distance in openGL coordinate space, you can multiply it by this value to convert it to map space, where the distance between adjacent tiles is 1.

Definition at line 1892 of file Map.cpp.

References height, and width.

◆ GetCornerHeight() [1/2]

long Map::GetCornerHeight ( long  x,
long  y,
tCorner  which,
tEdge  edge 
) const

Set the height of any one corner of a tile.

corner is kTopLeft, kBottomLeft, kTopRight or kBottomRight edge is kBottomEdge, kLeftEdge, kRightEdge, kTopEdge returns kUndefinedHeight if the split is inconsistant with the tile type The combination of a corner and an edge uniquely define a single height

Definition at line 1204 of file Map.cpp.

References halfTile::corners, GetSplit(), kBackwardSplit, kBottomEdge, kBottomLeft, kBottomRight, kForwardSplit, kLeftEdge, kNoSplit, kRightEdge, kTopEdge, kTopLeft, kTopRight, kUndefinedHeight, land, Tile::tile1, and Tile::tile2.

Referenced by AdjacentEdges(), loadOctileCorner(), and SmoothSetRectHeight().

◆ GetCornerHeight() [2/2]

long Map::GetCornerHeight ( long  x,
long  y,
tCorner  which,
tSplitSide  split = kWholeTile 
) const

Get the height of any one corner of a tile.

corner is kTopLeft, kBottomLeft, kTopRight or kBottomRight split is kLeftSide, kRightSide or kWholeTile returns kUndefinedHeight if the split is inconsistant with the tile type The combination of a corner and a split side uniquely define a single height

Definition at line 1278 of file Map.cpp.

References halfTile::corners, kBackwardSplit, kBottomLeft, kBottomRight, kForwardSplit, kLeftSide, kNoSplit, kRightSide, kTopLeft, kTopRight, kUndefinedHeight, kWholeTile, land, split(), Tile::tile1, and Tile::tile2.

◆ GetDrawLand()

bool Map::GetDrawLand ( )
inline

Definition at line 216 of file Map.h.

References drawLand.

◆ GetEdgeWidthX()

float Map::GetEdgeWidthX ( int  x,
int  y 
)

Returns the edge width between (x, y) and (x+1, y)

Definition at line 2498 of file Map.cpp.

References AdjacentEdges(), edgewidth, GetSplit(), height, kBottomEdge, kRightEdge, kTopEdge, and width.

◆ GetEdgeWidthY()

float Map::GetEdgeWidthY ( int  x,
int  y 
)

Returns the edge width between (x, y) and (x, y+1)

Definition at line 2541 of file Map.cpp.

References AdjacentEdges(), edgewidth, GetSplit(), height, kBottomEdge, kLeftEdge, kRightEdge, and width.

◆ GetHeight()

long Map::GetHeight ( long  x,
long  y,
tSplitSide  split = kWholeTile 
)

Get the (flat) height of the tile at x, y.

returns the height of a particular tile – actually just one corner of the tile. If the tile is sloping you'll get back kUndefined and need to get the specific corner heights. returns kUndefinedHeight if the tile is split and you specify the whole tile

Definition at line 1144 of file Map.cpp.

References halfTile::corners, kLeftSide, kNoSplit, kRightSide, kUndefinedHeight, kWholeTile, land, split(), Tile::tile1, and Tile::tile2.

Referenced by MakePseudoMaze().

◆ GetMapHeight()

long Map::GetMapHeight ( ) const
inline

◆ GetMapName()

const char * Map::GetMapName ( )

Definition at line 981 of file Map.cpp.

References map_name.

Referenced by MapEnvironment::GetName().

◆ GetMapWidth()

long Map::GetMapWidth ( ) const
inline

◆ GetNodeNum()

int Map::GetNodeNum ( int  x,
int  y,
tCorner  corner = kNone 
)

Gets the abstract Graph node number for this tile.

Because we have a Graph representation of the map as well, we need some way to get back and forth between the representations. This function will get the unique data (nodeNum) for a tile/half tile so that we can go from a tile in the map to a node in the Graph.

Definition at line 2339 of file Map.cpp.

References height, kBottomRight, kTopRight, land, halfTile::node, Tile::tile1, Tile::tile2, and width.

Referenced by ClusterAbstraction::createHorizEntrances(), ClusterAbstraction::createVertEntrances(), SearchUnit::makeMove(), ClusterAbstraction::setUpParents(), and SharedAMapGroup::UpdateLocation().

◆ GetOpenGLCoord() [1/2]

bool Map::GetOpenGLCoord ( float  _x,
float  _y,
GLdouble &  x,
GLdouble &  y,
GLdouble &  z,
GLdouble &  radius 
) const

Get the openGL coordinates of a given tile.

Given a tile in (x, y) coordinates, it returns the OpenGL space coordinates of that tile along with the radius of the tile square. The map is drawn in the x<->z plane, with the y plane up.

Definition at line 1861 of file Map.cpp.

References GetOpenGLCoord().

◆ GetOpenGLCoord() [2/2]

bool Map::GetOpenGLCoord ( int  _x,
int  _y,
GLdouble &  x,
GLdouble &  y,
GLdouble &  z,
GLdouble &  radius 
) const

◆ GetPointFromCoordinate()

void Map::GetPointFromCoordinate ( point3d  loc,
int &  px,
int &  py 
) const

◆ GetRevision()

int Map::GetRevision ( )
inline

Definition at line 226 of file Map.h.

References revision.

◆ GetSplit()

tSplit Map::GetSplit ( long  x,
long  y 
) const

Return the split of the tile at x, y.

Returns the type of split; either kNoSplit, kForwardSplit, kBackwardSplit

Definition at line 1004 of file Map.cpp.

References land, and Tile::split.

Referenced by GraphSearchConstants::AddEdges(), AddMapEdges(), AdjacentCorners(), AdjacentEdges(), GetCornerHeight(), GetEdgeWidthX(), GetEdgeWidthY(), and SmoothSetRectHeight().

◆ GetTerrainType() [1/2]

long Map::GetTerrainType ( long  x,
long  y,
tEdge  side 
) const

Get the terrain type for one side of the tile at x, y.

Gets the terrain type for a particular edge of the type. (kLeftEdge, kRightEdge, kTopEdge, kBottom Edge) This function avoids making you figure out all the ways a tile could be split to get the correct value out.

Definition at line 1077 of file Map.cpp.

References height, kBackwardSplit, kBottomEdge, kForwardSplit, kLeftEdge, kNoSplit, kRightEdge, kTopEdge, kUndefined, land, split(), Tile::tile1, Tile::tile2, halfTile::type, and width.

◆ GetTerrainType() [2/2]

long Map::GetTerrainType ( long  x,
long  y,
tSplitSide  split = kWholeTile 
) const

◆ GetTile()

Tile & Map::GetTile ( long  x,
long  y 
)

Return the tile at location x, y.

returns a reference to the type at a particular x/y location. (starting from 0)

Definition at line 994 of file Map.cpp.

References land.

Referenced by GraphSearchConstants::AddEdges(), AddMapEdges(), GraphSearchConstants::AddNodesToGraph(), and GetMapGraph().

◆ GetTileSet()

tTileset Map::GetTileSet ( )

Get the tileset used for land colors.

Definition at line 1758 of file Map.cpp.

References tileSet.

◆ isLegalStone()

bool Map::isLegalStone ( char  c)
private

Definition at line 817 of file Map.cpp.

Referenced by tryLoadRollingStone().

◆ Load() [1/2]

void Map::Load ( const char *  filename)

Resets the current map by loading the file passed in.

Resets the current map by loading the file passed in.

Definition at line 257 of file Map.cpp.

References dList, drawLand, height, land, map_name, revision, updated, and width.

Referenced by Map().

◆ Load() [2/2]

void Map::Load ( FILE *  f)

Resets the current map by loading the file from the pointer passed in.

Definition at line 292 of file Map.cpp.

References dList, drawLand, height, land, loadOctile(), loadOctileCorner(), loadRaw(), map_name, tryDragonAge(), tryLoadRollingStone(), updated, and width.

◆ loadOctile()

void Map::loadOctile ( FILE *  f,
int  height,
int  width 
)
private

◆ loadOctileCorner()

void Map::loadOctileCorner ( FILE *  f,
int  height,
int  width 
)
private

◆ loadRaw()

void Map::loadRaw ( FILE *  f,
int  height,
int  width 
)
private

Definition at line 340 of file Map.cpp.

References dList, drawLand, height, kNoGraphNode, kRaw, land, mapType, halfTile::node, Tile::tile1, Tile::tile2, updated, and width.

Referenced by Load().

◆ OpenGLDraw()

void Map::OpenGLDraw ( tDisplay  how = kPolygons) const

Does actual OpenGL drawing of the map.

If drawLand has been set (on by default) the ground will be drawn using the appropriate mode: kPolygons, kLines, kPoints kPolygon is the default mode. The map is cached in a display list unless it changes.

Definition at line 1777 of file Map.cpp.

References dList, drawLand, drawLandQuickly(), DrawTile(), height, kFast, land, tileSet, updated, verbose, and width.

Referenced by Map2DHeading::OpenGLDraw(), Directional2DEnvironment::OpenGLDraw(), and GraphEnvironment::OpenGLDraw().

◆ paintRoomInside()

void Map::paintRoomInside ( int  x,
int  y 
)
private

◆ Print()

void Map::Print ( int  _scale = 1)

Do an ASCII/ANSI print out of the map.

Moves the cursor to the top of the screen and draws an ASCII version of the map. The map is shrunk by a factor of 2 in the vertical scale, but left normal in the horizontal scale. For the moment we leave ground blank and draw the walls as x/X/^. No other ground type is drawn.

Definition at line 917 of file Map.cpp.

References height, kGround, kOutOfBounds, kSwamp, land, and width.

◆ Save() [1/3]

void Map::Save ( const char *  filename)

Saves the current map out to the designated file.

Saves the current map out to the designated file.

Definition at line 838 of file Map.cpp.

References Save().

◆ Save() [2/3]

void Map::Save ( FILE *  f)

Saves the current map out to the designated file.

Saves the current map out to the designated file.

Definition at line 856 of file Map.cpp.

References kOctile, kOctileCorner, kRaw, kSokoban, mapType, saveOctile(), and saveRaw().

◆ Save() [3/3]

void Map::Save ( std::stringstream &  data)

unimplemented.

Definition at line 831 of file Map.cpp.

Referenced by MyCLHandler(), and Save().

◆ saveOctile()

void Map::saveOctile ( FILE *  f)
private

Definition at line 873 of file Map.cpp.

References GetTerrainType(), height, kGround, kSwamp, kTrees, kWater, and width.

Referenced by Save().

◆ saveRaw()

void Map::saveRaw ( FILE *  f)
private

Definition at line 896 of file Map.cpp.

References height, land, and width.

Referenced by Save().

◆ Scale()

void Map::Scale ( long  newWidth,
long  newHeight 
)

◆ SetCornerHeight()

void Map::SetCornerHeight ( long  x,
long  y,
tCorner  which,
long  cHeight,
tSplitSide  split = kWholeTile 
)

Set the height of any one corner of a tile.

corner is kTopLeft, kBottomLeft, kTopRight or kBottomRight split is kLeftSide, kRightSide or kWholeTile The combination of a corner and a split side uniquely define a single height, which is returned.

Definition at line 1335 of file Map.cpp.

References halfTile::corners, kBackwardSplit, kBottomLeft, kBottomRight, kForwardSplit, kLeftSide, kNoSplit, kRightSide, kTopLeft, kTopRight, kWholeTile, land, revision, split(), Tile::tile1, and Tile::tile2.

Referenced by loadOctileCorner(), and SmoothSetRectHeight().

◆ SetDrawLand()

void Map::SetDrawLand ( bool  land)

Toggles whether the land is draw when you call OpenGLDraw.

Definition at line 1738 of file Map.cpp.

References drawLand.

◆ SetHeight()

void Map::SetHeight ( long  x,
long  y,
long  tHeight,
tSplitSide  split = kWholeTile 
)

Set the (flat) height of the tile at x, y.

Split is kWholeTile, kLeftSide or kRightSide.

Definition at line 1173 of file Map.cpp.

References halfTile::corners, kLeftSide, kRightSide, kWholeTile, land, revision, split(), Tile::tile1, and Tile::tile2.

Referenced by loadOctileCorner(), MakePseudoMaze(), SetRectHeight(), and tryLoadRollingStone().

◆ SetNodeNum()

void Map::SetNodeNum ( int  num,
int  x,
int  y,
tCorner  corner = kNone 
)

Sets the abstract Graph node number for this tile.

Because we have a Graph representation of the map as well, we need some way to get back and forth between the representations. This function will set the unique data (nodeNum) for a tile/half tile so that we can go from a tile in the map to a node in the Graph.

Definition at line 2319 of file Map.cpp.

References height, kBottomRight, kTopRight, land, halfTile::node, Tile::tile1, Tile::tile2, and width.

◆ SetRectHeight()

void Map::SetRectHeight ( long  x1,
long  y1,
long  x2,
long  y2,
long  h,
tTerrain  type = kGround 
)

Set the height and terrain of a set of tiles.

Sets all the tiles in the region between (x1, y1) (x2, y2) to be the same height and terrain type, with no splits.

Definition at line 1578 of file Map.cpp.

References kNoSplit, map_name, revision, SetHeight(), SetSplit(), SetTerrainType(), and updated.

Referenced by MakeMaze(), MakePseudoMaze(), and SmoothSetRectHeight().

◆ setSizeMultipler()

void Map::setSizeMultipler ( int  _sizeMultiplier)
inline

Definition at line 152 of file Map.h.

References sizeMultiplier.

◆ SetSplit()

void Map::SetSplit ( long  x,
long  y,
tSplit  split 
)

Set the split of the tile at x, y.

Sets how a map is split; either kNoSplit, kForwardSplit, kBackwardSplit

Definition at line 1014 of file Map.cpp.

References land, revision, split(), and Tile::split.

Referenced by SetRectHeight(), SmoothSetRectHeight(), and tryLoadRollingStone().

◆ SetTerrainType() [1/2]

void Map::SetTerrainType ( int32_t  x1,
int32_t  y1,
int32_t  x2,
int32_t  y2,
tTerrain  t 
)

Map::SetTerrainType()

Set all the terrain between two points to be the same

Parameters
x1The first x-coordinate to set
y1The first y-coordinate to set
x2The second x-coordinate to set
y2The second y-coordinate to set
terrainThe terrain for the line between the coordinates
Returns
none

Definition at line 1049 of file Map.cpp.

References updated.

Referenced by BuildRandomRoomMap(), Burrow(), loadOctile(), loadOctileCorner(), MakeMaze(), MakePseudoMaze(), MakeRandomMap(), paintRoomInside(), SetRectHeight(), SmoothSetRectHeight(), tryDragonAge(), tryLoadRollingStone(), and SharedAMapGroup::UpdateLocation().

◆ SetTerrainType() [2/2]

void Map::SetTerrainType ( long  x,
long  y,
tTerrain  type,
tSplitSide  split = kWholeTile 
)

Set the terrain type of the side of the tile at x, y.

side is one of kWholeTile, kLeftSide or kRightSide If tile is not split and you specify a split side, nothing happens If tile is split and you specify kWholeTile, the split remains, and the terrain is applied to both sides.

Definition at line 1108 of file Map.cpp.

References GetMapHeight(), GetMapWidth(), height, kLeftSide, kNoSplit, kRightSide, kWholeTile, land, map_name, revision, split(), Tile::tile1, Tile::tile2, halfTile::type, updated, and width.

◆ SetTileSet()

void Map::SetTileSet ( tTileset  ts)

Choose the tileset used for land colors.

Tilesets named xxxTile will draw the map as independant tiles as opposed to a smooth connected map.

Definition at line 1747 of file Map.cpp.

References InitTextures(), kBitmap, tileSet, and updated.

Referenced by CreateSimulation().

◆ SmoothSetRectHeight()

void Map::SmoothSetRectHeight ( long  x1,
long  y1,
long  x2,
long  y2,
long  h,
tTerrain  type = kGround 
)

Places a rectangle into the map, but also modifies the edges to make the transition smooth.

sets a rectangle of with corner coordinates (x1, y1) (x2, y2) but also takes the 1-radius tiles surrounding that rectangle and smooths them so you get a nice fit of land together.

Definition at line 1395 of file Map.cpp.

References GetCornerHeight(), GetSplit(), kBackwardSplit, kBottomLeft, kBottomRight, kForwardSplit, kLeftSide, kNoSplit, kRightSide, kTopLeft, kTopRight, map_name, SetCornerHeight(), SetRectHeight(), SetSplit(), SetTerrainType(), and updated.

◆ Trim()

void Map::Trim ( )

Definition at line 212 of file Map.cpp.

References GetTerrainType(), height, kOutOfBounds, land, map_name, max, min(), revision, updated, and width.

◆ tryDragonAge()

bool Map::tryDragonAge ( FILE *  f)
private

◆ tryLoadRollingStone()

bool Map::tryLoadRollingStone ( FILE *  f)
private

Member Data Documentation

◆ dList

GLuint Map::dList
mutableprivate

◆ drawLand

bool Map::drawLand
private

◆ height

int Map::height
private

◆ land

Tile** Map::land
private

◆ map_name

char Map::map_name[128]
private

Definition at line 245 of file Map.h.

Referenced by GetMapName(), Load(), Map(), Scale(), SetRectHeight(), SetTerrainType(), SmoothSetRectHeight(), and Trim().

◆ mapType

tMapType Map::mapType
private

◆ revision

int Map::revision
private

◆ sizeMultiplier

int Map::sizeMultiplier
private

Definition at line 243 of file Map.h.

Referenced by loadOctile(), Map(), and setSizeMultipler().

◆ tileSet

tTileset Map::tileSet
private

Definition at line 247 of file Map.h.

Referenced by DoVertexColor(), DrawTile(), GetTileSet(), Map(), OpenGLDraw(), and SetTileSet().

◆ updated

bool Map::updated
mutableprivate

◆ width

int Map::width
private

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