#include "map.hpp"
#include <map>
#include <string>
#include <vector>
Go to the source code of this file.
Classes | |
class | map_generator |
Functions | |
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< gamemap::location, std::string > *labels, const config &cfg) |
Generate the map. |
Definition in file mapgen.hpp.
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< gamemap::location, std::string > * | labels, | |||
const config & | cfg | |||
) |
Generate the map.
Convert grassland terrain to other types of flat terrain. We generate a 'temperature map' which uses the height generation algorithm to generate the temperature levels all over the map. Then we can use a combination of height and terrain to divide terrain up into more interesting types than the default.
Place villages in a 'grid', to make placing fair, but with villages displaced from their position according to terrain and randomness, to add some variety.
Try to find configuration for castles.
Castle configuration tag contains a 'valid_terrain' attribute which is a list of terrains that the castle may appear on.
Attempt to place castles at random. Once we have placed castles, we run a sanity check to make sure that the castles are well-placed. If the castles are not well-placed, we try again. Definition of 'well-placed' is if no two castles are closer than 'min_distance' hexes from each other, and the castles appear on a terrain listed in 'valid_terrain'.
We want the locations to be on the portion of the map we're actually going to use, since roads on other parts of the map won't have any influence, and doing it like this will be quicker.
Definition at line 703 of file mapgen.cpp.
References _, a_star_search(), config::child(), config::empty(), ERR_NG, config::find_child(), t_translation::FOREST, generate_height_map(), generate_lake(), generate_name(), generate_river(), get_adjacent_tiles(), config::get_children(), t_translation::GRASS_LAND, t_translation::HILL, t_translation::HUMAN_CASTLE, t_translation::HUMAN_KEEP, is_even(), loc, LOG_NG, log_scope, t_translation::MOUNTAIN, name, boost::foreach_detail_::next(), output_map(), place_village(), r, random_point_at_side(), rank_castle_location(), t_translation::read_list(), t_translation::read_terrain_code(), utils::split(), paths::route::steps, VALIDATE, t_translation::write_terrain_code(), gamemap::location::x, and gamemap::location::y.
Referenced by default_map_generator::generate_map().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |