Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ChunkLayer Class Reference

Public Member Functions

 ChunkLayer (int _width, int _height)
 
 ChunkLayer (int _width, int _height, bool has_layer_below)
 
 ChunkLayer (const ChunkLayer &l)
 
void clear ()
 
ChunkLayeroperator= (const ChunkLayer &d)
 
Tileget_tile_pointer (int row, int col)
 
Tileget_tile_pointer (IntPoint point)
 
Tile get_tile (int row, int col) const
 
Tile get_tile (IntPoint point) const
 
void set_tile (int row, int col, Tile tile_type)
 
void set_tile (IntPoint point, Tile tile_type)
 
std::vector< std::vector< Tile > > & get_ground ()
 
std::vector< Item * > & get_items ()
 
std::vector< EquipType > & get_equipment ()
 
std::vector< WeaponType > & get_weapons ()
 
std::vector< Spawner > & get_spawners ()
 
void add_item (Item *item)
 
void make_stairs (bool has_layer_below)
 
void make_spawner (int depth)
 
void make_spawner (int depth, IntPoint point)
 
void layer_dump ()
 

Public Attributes

IntPoint down_stair
 
IntPoint up_stair
 
IntPoint spawner_loc
 
int width
 
int height
 
bool has_layer_below
 
int num_rooms
 
std::vector< Roomrooms
 
std::vector< Spawnerspawners
 

Private Member Functions

void swap (const ChunkLayer &l)
 
void tile_assertions (int row, int col) const
 

Private Attributes

TileMatrix ground
 
std::vector< Item * > items
 
std::vector< EquipTypeequipment
 
std::vector< WeaponTypeweapons
 
std::vector< IntPointdown_stairs
 
std::vector< IntPointup_stairs
 

Static Private Attributes

static const int MAX_ROOMS =15
 

Member Function Documentation

void ChunkLayer::add_item ( Item item)

Adds an item to the item list for this chunk.

Parameters
item- a pointer to the item to add.
void ChunkLayer::clear ( )

Resets the chunk layer to its default settings.

std::vector< EquipType > & ChunkLayer::get_equipment ( )
Returns
a vector of the equipment on this chunk.
Todo:
return a reference so we don't have to copy
TileMatrix & ChunkLayer::get_ground ( )
Returns
a reference to the matrix of tiles on this layer.
std::vector< Item * > & ChunkLayer::get_items ( )
Returns
a pointer to the list of item pointers on this chunk.
Todo:
why a pointer and not a reference? There could be a legit reason. -Seth
std::vector< Spawner > & ChunkLayer::get_spawners ( )
Returns
the spawners on this chunk.
Tile * ChunkLayer::get_tile_pointer ( int  row,
int  col 
)

Returns the tile at the given (row, col) location.

Parameters
row
col
Returns
a pointer to the tile at that location
std::vector< WeaponType > & ChunkLayer::get_weapons ( )
Returns
a vector of the weapons on this chunk.
Todo:
return a reference so we don't have to copy
void ChunkLayer::layer_dump ( )

Prints an ASCII representation of the layer to stdout.

void ChunkLayer::make_spawner ( int  depth)
Parameters
depththe depth at which to build a spawner

Builds a monster spawner in a random room at the given depth.

Todo:
should go in dungeon gen
void ChunkLayer::make_stairs ( bool  has_layer_below)
Parameters
has_layer_belowa bool denoting whether or not there is a layer below this dungeon.

Create an "up stair" in a random room and a "down stair" in a random room (if there is a chunk below).

Todo:
This should be in dungeon generation.
ChunkLayer & ChunkLayer::operator= ( const ChunkLayer d)
Parameters
da reference to another dungeon
Returns
a reference to this dungeon
void ChunkLayer::set_tile ( int  row,
int  col,
Tile  tile_type 
)

Sets the tile at the given location.

Parameters
row
col
tile_type
void ChunkLayer::swap ( const ChunkLayer l)
private

Copies over all values from the given layer to this layer.

Parameters
l- The layer from which to swap ownership.
Todo:
this is weird as balls
void ChunkLayer::tile_assertions ( int  row,
int  col 
) const
private
Parameters
row
colRun the given point in the dungeon through a series of assertions to ensure that it is valid.

Member Data Documentation

IntPoint ChunkLayer::down_stair
Todo:
these should be gone in a few commits.
std::vector<IntPoint> ChunkLayer::down_stairs
private

A vector of IntPoints representing the location of down stairs on this chunk.

std::vector<EquipType> ChunkLayer::equipment
private

A vector storing all equipment on the chunk.

TileMatrix ChunkLayer::ground
private

The central data model for the class: A two-dimensional matrix storing the layer's tiles.

bool ChunkLayer::has_layer_below

True if there is a layer below this one.

int ChunkLayer::height

The height of this layer.

std::vector<Item*> ChunkLayer::items
private

A vector storing pointers to each item on the chunk.

int ChunkLayer::num_rooms

The number of rooms in this layer.

Todo:
figure out what to do with this.
std::vector<Room> ChunkLayer::rooms

A vector containing data about the rooms in this dungeon.

std::vector<Spawner> ChunkLayer::spawners

Any monster spawners that are stored on this layer.

std::vector<IntPoint> ChunkLayer::up_stairs
private

The coordinates of the stair leading to the layer above this one, if such a layer exists.

std::vector<WeaponType> ChunkLayer::weapons
private

All weapons on the chunk.

int ChunkLayer::width

The width of this layer.


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