The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
default_map_generator_job Class Reference

#include <default_map_generator_job.hpp>

Public Member Functions

 default_map_generator_job ()
 
 default_map_generator_job (boost::uint32_t seed)
 
std::string default_generate_map (size_t width, size_t height, size_t island_size, size_t island_off_center, size_t iterations, size_t hill_size, size_t max_lakes, size_t nvillages, size_t castle_size, size_t nplayers, bool roads_between_castles, std::map< map_location, std::string > *labels, const config &cfg)
 Generate the map. More...
 

Private Types

typedef std::vector
< std::vector< int > > 
height_map
 
typedef t_translation::t_map terrain_map
 

Private Member Functions

bool generate_river_internal (const height_map &heights, terrain_map &terrain, int x, int y, std::vector< map_location > &river, std::set< map_location > &seen_locations, int river_uphill)
 
std::vector< map_locationgenerate_river (const height_map &heights, terrain_map &terrain, int x, int y, int river_uphill)
 
height_map generate_height_map (size_t width, size_t height, size_t iterations, size_t hill_size, size_t island_size, size_t island_off_center)
 Generate a height-map. More...
 
bool generate_lake (t_translation::t_map &terrain, int x, int y, int lake_fall_off, std::set< map_location > &locs_touched)
 Generate a lake. More...
 
map_location random_point_at_side (size_t width, size_t height)
 Returns a random tile at one of the borders of a map that is of the given dimensions. More...
 
std::string generate_name (boost::shared_ptr< name_generator > &name_generator, const std::string &id, std::string *base_name=nullptr, utils::string_map *additional_symbols=nullptr)
 

Private Attributes

boost::random::mt19937 rng_
 

Detailed Description

Definition at line 34 of file default_map_generator_job.hpp.

Member Typedef Documentation

typedef std::vector<std::vector<int> > default_map_generator_job::height_map
private

Definition at line 48 of file default_map_generator_job.hpp.

Definition at line 49 of file default_map_generator_job.hpp.

Constructor & Destructor Documentation

default_map_generator_job::default_map_generator_job ( )

Definition at line 42 of file default_map_generator_job.cpp.

default_map_generator_job::default_map_generator_job ( boost::uint32_t  seed)

Definition at line 48 of file default_map_generator_job.cpp.

Member Function Documentation

std::string default_map_generator_job::default_generate_map ( size_t  width,
size_t  height,
size_t  island_size,
size_t  island_off_center,
size_t  iterations,
size_t  hill_size,
size_t  max_lakes,
size_t  nvillages,
size_t  castle_size,
size_t  nplayers,
bool  roads_between_castles,
std::map< map_location, std::string > *  labels,
const config cfg 
)
height_map default_map_generator_job::generate_height_map ( size_t  width,
size_t  height,
size_t  iterations,
size_t  hill_size,
size_t  island_size,
size_t  island_off_center 
)
private

Generate a height-map.

Basically we generate a lot of hills, each hill being centered at a certain point, with a certain radius - being a half sphere. Hills are combined additively to form a bumpy surface. The size of each hill varies randomly from 1-hill_size. We generate 'iterations' hills in total. The range of heights is normalized to 0-1000. 'island_size' controls whether or not the map should tend toward an island shape, and if so, how large the island should be. Hills with centers that are more than 'island_size' away from the center of the map will be inverted (i.e. be valleys). 'island_size' as 0 indicates no island.

Definition at line 72 of file default_map_generator_job.cpp.

References i, int(), LOG_NG, and rng_.

Referenced by default_generate_map().

bool default_map_generator_job::generate_lake ( t_translation::t_map terrain,
int  x,
int  y,
int  lake_fall_off,
std::set< map_location > &  locs_touched 
)
private

Generate a lake.

It will create water at (x,y), and then have 'lake_fall_off' % chance to make another water tile in each of the directions n,s,e,w. In each of the directions it does make another water tile, it will have 'lake_fall_off'/2 % chance to make another water tile in each of the directions. This will continue recursively.

Definition at line 198 of file default_map_generator_job.cpp.

References rng_, and t_translation::SHALLOW_WATER.

Referenced by default_generate_map().

std::string default_map_generator_job::generate_name ( boost::shared_ptr< name_generator > &  name_generator,
const std::string id,
std::string base_name = nullptr,
utils::string_map additional_symbols = nullptr 
)
private
std::vector< location > default_map_generator_job::generate_river ( const height_map heights,
terrain_map terrain,
int  x,
int  y,
int  river_uphill 
)
private

Definition at line 311 of file default_map_generator_job.cpp.

References generate_river_internal().

Referenced by default_generate_map().

bool default_map_generator_job::generate_river_internal ( const height_map heights,
terrain_map terrain,
int  x,
int  y,
std::vector< map_location > &  river,
std::set< map_location > &  seen_locations,
int  river_uphill 
)
private
map_location default_map_generator_job::random_point_at_side ( size_t  width,
size_t  height 
)
private

Returns a random tile at one of the borders of a map that is of the given dimensions.

Definition at line 327 of file default_map_generator_job.cpp.

References rng_.

Referenced by default_generate_map().

Member Data Documentation

boost::random::mt19937 default_map_generator_job::rng_
private

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