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

#include <building.h>

Public Member Functions

 Building ()
 
 Building (int x, int y, int _height, int _width)
 
Tile get_floor ()
 
Tile get_wall ()
 
TileMatrix & get_floor_plan ()
 
int get_x ()
 
int get_y ()
 
int get_width ()
 
int get_height ()
 
Tile tile_at (int y, int x)
 

Private Member Functions

void house_from_bst ()
 
void rooms_from_tree (BSpaceTree &tree)
 
void rooms_to_floor ()
 
bool add_doors (BSpaceTree &bst)
 
void connect_nodes (BSpaceNode *node)
 
void add_random_door (BSpaceNode *node)
 
int surrounding_walls (int y, int x)
 

Private Attributes

IntPoint tl
 
int height
 
int width
 
int num_floors
 
Tile wall
 
Tile floor
 
std::vector< Roomrooms
 
TileMatrix floor_plan
 

Detailed Description

The class which is responsible for making buildings.

Constructor & Destructor Documentation

Building::Building ( )

The default constructor for a building.

Building::Building ( int  x,
int  y,
int  _height,
int  _width 
)

Constructor for buildings that actually builds the building. At the moment, this does very little as I need to think of a good way to incorporate all of the variables that I need. Basically, it's going to make a square house with several rooms and a door.

Parameters
_build_areaThe area to build on.
_start_pointThe coordinates of the top left corner in the build_area.
_sizeThe size of the building (height and width).
_roomsThe number of rooms in the building.
Todo:
Once seth figures out the whole depth thing, add a number of floors

Member Function Documentation

bool Building::add_doors ( BSpaceTree bst)
private

Recursively adds doors in between every left-right pair of nodes.

void Building::add_random_door ( BSpaceNode node)
private

Adds a door to a random place on the outside of the node.

void Building::connect_nodes ( BSpaceNode node)
private

Actual recursive part of the add_doors() function.

Tile Building::get_floor ( )

Accessor for the floor tile.

TileMatrix & Building::get_floor_plan ( )

Accessor for the floor plan.

int Building::get_height ( )

Accessor for the height.

Tile Building::get_wall ( )

Accessor for the wall tile.

int Building::get_width ( )

Accessor for the width.

int Building::get_x ( )

Accessor for the x coordinate.

int Building::get_y ( )

Accessor for the y coordinate.

void Building::house_from_bst ( )
private

Generates the rooms and floor plan from a Binary Space Tree generated in the height and width of the house. Also adds...umm...doors. That's what they're called. Adds Doors in between the rooms.

void Building::rooms_from_tree ( BSpaceTree tree)
private

Recursively turns the nodes stemming from a root node passed in into room objects.

void Building::rooms_to_floor ( )
private

Maps the rooms into a floor plan.

int Building::surrounding_walls ( int  y,
int  x 
)
private

Checks the number of walls surrounding a given tile.

Tile Building::tile_at ( int  y,
int  x 
)

Gets a tile at a given x and y.

Member Data Documentation

Tile Building::floor
private

The tile that corresponds to what the floor is made out of.

TileMatrix Building::floor_plan
private

Holds the tiles of the house.

int Building::height
private

The size of the building (height, width).

int Building::num_floors
private

The number of floors in the house.

std::vector<Room> Building::rooms
private

A list of the rooms.

IntPoint Building::tl
private

The location of the top left corner of the buildling.

Tile Building::wall
private

Changes the way that the house is constructed. Corresponds to an enum. Really just a way so that I can say "if(plan == PARALLEL){..." instead of needing to keep track of indexes. The shape of the buildling. Will be a circular or rectangular. Almost all houses will be circles. Again, corresponds to an enum to access instead of index values. The tile that corresponds to what the wall is made out of.

int Building::width
private

The width of the building.


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