Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Classes | Functions
dungeon_builder Namespace Reference

Classes

struct  dungeon_meta
 

Functions

bool rolled_over (int given)
 
bool is_empty_space (IntPoint point, const dungeon_meta &dm)
 
bool point_is_beyond_bounds (IntPoint point, const dungeon_meta &dm)
 
std::bitset< 4 > edges_collide_with_something (Room &r, const dungeon_meta &dm)
 
int determine_which_wall (IntPoint point, const dungeon_meta &dm)
 
Room build_room (IntPoint tl, IntPoint br, dungeon_meta &dm)
 
IntPoint rand_wall_block (const Room &current_room)
 
IntPoint get_next_point (IntPoint this_point, int direction)
 
void set_wall_if_not_path (int row, int col, dungeon_meta &dm)
 
void reset (dungeon_meta &dm)
 
ChunkLayerget_dungeon (dungeon_meta &dm)
 

Detailed Description

A namespace from which all dungeon-building classes inherit.

This provides core functionality that those dungeon builders share.

See also
ProcedurallyBlindDB
CorruptiblePBlindDB

Function Documentation

Room dungeon_builder::build_room ( IntPoint  tl,
IntPoint  br,
dungeon_meta &  dm 
)

Builds a room in the dungeon with the given points.

Parameters
tl- the top-left corner of the room.
br- the bottom-right corner of the room.
dm- instance of a dungeon to work on
Returns
The room that was built.
See also
room
int dungeon_builder::determine_which_wall ( IntPoint  point,
const dungeon_meta &  dm 
)

Determines which wall of a room a given point lies on.

Parameters
point- a point which has previously been determined to lie on the edge of a room wall.
dm- instance of a dungeon to work on
Returns
An integer denoting the wall that the given room lies on, where 0 = top, 1 = right, 2 = bottom, 3 = left.
std::bitset< 4 > dungeon_builder::edges_collide_with_something ( Room r,
const dungeon_meta &  dm 
)

Determines whether the edges of a given room collide with another room.

Parameters
r- the room to check
dm- instance of a dungeon to work on
Returns
A binary string that denotes which edges of the room found collisions; the first bit is the top edge, then right, then bottom, then left.
Todo:
maybe use a bitset here.
IntPoint dungeon_builder::get_next_point ( IntPoint  ,
int   
)

Finds the adjacent point in the given direction

Parameters
this_point- the current point.
direction- the direction to move, where 0 = up, 1 = right, 2 = down, and 3 = left.
Returns
The point that was found.
bool dungeon_builder::is_empty_space ( IntPoint  point,
const dungeon_meta &  dm 
)

Check if the given point on the dungeon model can be written over.

Parameters
point- the point to check.
dm- instance of a dungeon to work on
Returns
True if the given point is empty.
bool dungeon_builder::point_is_beyond_bounds ( IntPoint  point,
const dungeon_meta &  dm 
)

Determines whether or not the given point is beyond the bounds of the dungeon.

Parameters
point- the point to check
dm- instance of a dungeon to work on
Returns
True if the point is out of bounds.
IntPoint dungeon_builder::rand_wall_block ( const Room )

Finds a random tile on the circumference of the given room.

Parameters
current_room- the room to use.
Returns
A random IntPoint on the circumference of this room.
void dungeon_builder::reset ( dungeon_meta &  dm)

Resets the num_rooms and main_dungeon variables, effectively clearing the dungeon. The dungeon must be initialized before calling this method.

Parameters
dm- instance of a dungeon to work on
bool dungeon_builder::rolled_over ( int  given)

Has an n% chance of returning 'true', where n is the given number.

Parameters
given- the desired probability that this check will return true.
Returns
True if a random roll between 1 and 100 landed below the given number.
void dungeon_builder::set_wall_if_not_path ( int  row,
int  col,
dungeon_meta &  dm 
)

Sets the given point to a ROOM_WALL tile if it is not a PATH tile.

Parameters
row
col
dm- instance of a dungeon to work on