duncan
Mom and Dad were wrong!
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
map::Map Class Reference

#include <map.h>

Inheritance diagram for map::Map:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Map (const std::string &)
void reset ()
virtual bool load (const std::string &)
bool is_vacant (size_t, size_t) const
size_t width () const
size_t height () const
net::maphash_t hash ()

Static Public Member Functions

static net::maphash_t hash (const std::string &)

Protected Member Functions

size_t encode (size_t r, size_t c) const
char tile (size_t r, size_t c) const

Static Protected Member Functions

static net::maphash_t hash (size_t, size_t, const std::vector< char > &)

Protected Attributes

size_t width_
size_t height_
std::vector< char > map_
net::maphash_t hash_

Detailed Description

Store information about a map, and draw it in a specified ncurses window.

Author:
Harry Slatyer
Malcolm Gill

see LICENSE


Constructor & Destructor Documentation

Map::Map ( const std::string &  str)

Load the map from a file.

Parameters:
strname of the file
Exceptions:
std::runtime_errorif map cannot be loaded

Member Function Documentation

size_t map::Map::encode ( size_t  r,
size_t  c 
) const [inline, protected]

Get the index in map_ of a particular tile.

Parameters:
rrow of tile
ccolumn of tile
Returns:
index in map_ of tile
net::maphash_t Map::hash ( )

Get the hash of this map.

Returns:
hash of the map
net::maphash_t Map::hash ( const std::string &  str) [static]

Get the hash of the a certain map (0 if it doesn't exist).

Parameters:
strfilename of the map
Returns:
hash of the map
net::maphash_t Map::hash ( size_t  w,
size_t  h,
const std::vector< char > &  tiles 
) [static, protected]

Get the hash of a map.

Parameters:
wwidth
hheight
tilesmap data
Returns:
hash of the map
size_t Map::height ( ) const

Get the height of the map.

Returns:
height of map
bool Map::is_vacant ( size_t  r,
size_t  c 
) const
Returns:
true iff the specified tile on the map can be traversed
Parameters:
rrow
ccolumn
bool Map::load ( const std::string &  str) [virtual]

Load the map from a file.

Parameters:
strname of the file
Returns:
whether or not the map loaded successfully

Reimplemented in server::ServerMap.

void Map::reset ( )

Reset the map.

char map::Map::tile ( size_t  r,
size_t  c 
) const [inline, protected]
Parameters:
rrow of tile
ccolumn of tile
Returns:
the value of the tile at the specified coordinate.
size_t Map::width ( ) const

Get the width of the map.

Returns:
width of map

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations