#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< Room > | rooms |
TileMatrix | floor_plan |
The class which is responsible for making buildings.
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.
_build_area | The area to build on. |
_start_point | The coordinates of the top left corner in the build_area. |
_size | The size of the building (height and width). |
_rooms | The number of rooms in the building. |
|
private |
Recursively adds doors in between every left-right pair of nodes.
|
private |
Adds a door to a random place on the outside of the 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.
|
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.
|
private |
Recursively turns the nodes stemming from a root node passed in into room objects.
|
private |
Maps the rooms into a floor plan.
|
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.
|
private |
The tile that corresponds to what the floor is made out of.
|
private |
Holds the tiles of the house.
|
private |
The size of the building (height, width).
|
private |
The number of floors in the house.
|
private |
A list of the rooms.
|
private |
The location of the top left corner of the buildling.
|
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.
|
private |
The width of the building.