Classes | Public Member Functions | Private Member Functions | Private Attributes

cave_map_generator Class Reference

#include <cavegen.hpp>

Inheritance diagram for cave_map_generator:
Inheritance graph
[legend]
Collaboration diagram for cave_map_generator:
Collaboration graph
[legend]

List of all members.

Classes

struct  chamber
struct  passage

Public Member Functions

 cave_map_generator (const config &game_config)
bool allow_user_config () const
 Returns true iff the map generator has an interactive screen, which allows the user to modify how the generator behaves.
void user_config (display &)
 Display the interactive screen, which allows the user to modify how the generator behaves.
std::string name () const
 Returns a string identifying the generator by name.
std::string config_name () const
 Return a friendly name for the generator used to differentiate between different configs of the same generator.
std::string create_map (const std::vector< std::string > &args)
 Creates a new map and returns it.
config create_scenario (const std::vector< std::string > &args)

Private Member Functions

void generate_chambers ()
void build_chamber (map_location loc, std::set< map_location > &locs, size_t size, size_t jagged)
void place_chamber (const chamber &c)
void place_passage (const passage &p)
bool on_board (const map_location &loc) const
void set_terrain (map_location loc, t_translation::t_terrain t)
void place_castle (int starting_position, const map_location &loc)
size_t translate_x (size_t x) const
size_t translate_y (size_t y) const

Private Attributes

t_translation::t_terrain wall_
t_translation::t_terrain clear_
t_translation::t_terrain village_
t_translation::t_terrain castle_
t_translation::t_terrain keep_
t_translation::t_map map_
std::map< int,
t_translation::coordinate
starting_positions_
std::map< std::string, size_t > chamber_ids_
std::vector< chamberchambers_
std::vector< passagepassages_
config res_
config cfg_
int width_
int height_
int village_density_
bool flipx_
bool flipy_

Detailed Description

Definition at line 27 of file cavegen.hpp.


Constructor & Destructor Documentation

cave_map_generator::cave_map_generator ( const config game_config  ) 

Definition at line 34 of file cavegen.cpp.

References cfg_, flipx_, flipy_, height_, LOG_NG, village_density_, and width_.


Member Function Documentation

bool cave_map_generator::allow_user_config (  )  const [inline, virtual]

Returns true iff the map generator has an interactive screen, which allows the user to modify how the generator behaves.

Implements map_generator.

Definition at line 32 of file cavegen.hpp.

void cave_map_generator::build_chamber ( map_location  loc,
std::set< map_location > &  locs,
size_t  size,
size_t  jagged 
) [private]

Definition at line 134 of file cavegen.cpp.

References get_adjacent_tiles(), and on_board().

Referenced by generate_chambers(), and place_passage().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string cave_map_generator::config_name (  )  const [virtual]

Return a friendly name for the generator used to differentiate between different configs of the same generator.

Implements map_generator.

Definition at line 67 of file cavegen.cpp.

std::string cave_map_generator::create_map ( const std::vector< std::string > &  args  )  [virtual]

Creates a new map and returns it.

args may contain arguments to the map generator.

Implements map_generator.

Definition at line 90 of file cavegen.cpp.

References create_scenario().

Here is the call graph for this function:

config cave_map_generator::create_scenario ( const std::vector< std::string > &  args  )  [virtual]

Reimplemented from map_generator.

Definition at line 96 of file cavegen.cpp.

References config::add_child(), cfg_, chambers_, config::child(), config::clear(), gamemap::default_border, generate_chambers(), height_, LOG_NG, preferences::map(), map_, passages_, place_chamber(), place_passage(), res_, starting_positions_, wall_, width_, and t_translation::write_game_map().

Referenced by create_map().

Here is the call graph for this function:

Here is the caller graph for this function:

void cave_map_generator::generate_chambers (  )  [private]
std::string cave_map_generator::name (  )  const [inline, virtual]

Returns a string identifying the generator by name.

The name should not contain spaces.

Implements map_generator.

Definition at line 36 of file cavegen.hpp.

bool cave_map_generator::on_board ( const map_location loc  )  const [inline, private]

Definition at line 73 of file cavegen.hpp.

References height_, width_, map_location::x, and map_location::y.

Referenced by build_chamber(), and set_terrain().

Here is the caller graph for this function:

void cave_map_generator::place_castle ( int  starting_position,
const map_location loc 
) [private]

Definition at line 346 of file cavegen.cpp.

References castle_, gamemap::default_border, get_adjacent_tiles(), keep_, set_terrain(), starting_positions_, map_location::x, and map_location::y.

Referenced by place_chamber().

Here is the call graph for this function:

Here is the caller graph for this function:

void cave_map_generator::place_chamber ( const chamber c  )  [private]

Definition at line 216 of file cavegen.cpp.

References config::add_child(), config::all_children_range(), config::any_child::cfg, config::child(), clear_, cave_map_generator::chamber::items, config::any_child::key, cave_map_generator::chamber::locs, place_castle(), res_, and set_terrain().

Referenced by create_scenario().

Here is the call graph for this function:

Here is the caller graph for this function:

void cave_map_generator::place_passage ( const passage p  )  [private]

Definition at line 305 of file cavegen.cpp.

References pathfind::a_star_search(), build_chamber(), cave_map_generator::passage::cfg, clear_, cave_map_generator::passage::dst, height_, map_, set_terrain(), cave_map_generator::passage::src, pathfind::plain_route::steps, wall_, and width_.

Referenced by create_scenario().

Here is the call graph for this function:

Here is the caller graph for this function:

void cave_map_generator::set_terrain ( map_location  loc,
t_translation::t_terrain  t 
) [private]

Definition at line 332 of file cavegen.cpp.

References clear_, gamemap::default_border, map_, on_board(), village_, village_density_, wall_, map_location::x, and map_location::y.

Referenced by place_castle(), place_chamber(), and place_passage().

Here is the call graph for this function:

Here is the caller graph for this function:

size_t cave_map_generator::translate_x ( size_t  x  )  const [private]

Definition at line 72 of file cavegen.cpp.

References flipx_, and width_.

Referenced by generate_chambers().

Here is the caller graph for this function:

size_t cave_map_generator::translate_y ( size_t  y  )  const [private]

Definition at line 81 of file cavegen.cpp.

References flipy_, and height_.

Referenced by generate_chambers().

Here is the caller graph for this function:

void cave_map_generator::user_config ( display disp  )  [inline, virtual]

Display the interactive screen, which allows the user to modify how the generator behaves.

(This function will not be called if allow_user_config() returns false).

Implements map_generator.

Definition at line 34 of file cavegen.hpp.


Member Data Documentation

Definition at line 81 of file cavegen.hpp.

Referenced by place_castle().

Definition at line 90 of file cavegen.hpp.

Referenced by cave_map_generator(), create_scenario(), and generate_chambers().

std::map<std::string,size_t> cave_map_generator::chamber_ids_ [private]

Definition at line 85 of file cavegen.hpp.

Referenced by generate_chambers().

std::vector<chamber> cave_map_generator::chambers_ [private]

Definition at line 86 of file cavegen.hpp.

Referenced by create_scenario(), and generate_chambers().

Definition at line 81 of file cavegen.hpp.

Referenced by place_chamber(), place_passage(), and set_terrain().

Definition at line 95 of file cavegen.hpp.

Referenced by cave_map_generator(), and translate_x().

Definition at line 95 of file cavegen.hpp.

Referenced by cave_map_generator(), and translate_y().

Definition at line 81 of file cavegen.hpp.

Referenced by place_castle().

Definition at line 82 of file cavegen.hpp.

Referenced by create_scenario(), place_passage(), and set_terrain().

std::vector<passage> cave_map_generator::passages_ [private]

Definition at line 87 of file cavegen.hpp.

Referenced by create_scenario(), and generate_chambers().

Definition at line 89 of file cavegen.hpp.

Referenced by create_scenario(), and place_chamber().

Definition at line 83 of file cavegen.hpp.

Referenced by create_scenario(), and place_castle().

Definition at line 81 of file cavegen.hpp.

Referenced by set_terrain().

Definition at line 91 of file cavegen.hpp.

Referenced by cave_map_generator(), and set_terrain().

Definition at line 81 of file cavegen.hpp.

Referenced by create_scenario(), place_passage(), and set_terrain().


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

Generated by doxygen 1.7.1 on Thu May 24 2012 01:13:13 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs