The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
default_map_generator_job.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /** @file */
16 
17 #ifndef DEFAULT_MAP_GENERATOR_JOB_HPP_INCLUDED
18 #define DEFAULT_MAP_GENERATOR_JOB_HPP_INCLUDED
19 
20 class config;
21 class unit_race;
22 
23 #include "util.hpp"
24 #include "map/location.hpp"
25 #include "terrain/translation.hpp"
27 #include "utils/name_generator.hpp"
28 
29 #include <boost/random.hpp>
30 #include <boost/cstdint.hpp>
31 #include <boost/smart_ptr/shared_ptr.hpp>
32 #include <map>
33 
35 {
36 public:
39 
40  /** Generate the map. */
41  std::string default_generate_map(size_t width, size_t height, size_t island_size, size_t island_off_center,
42  size_t iterations, size_t hill_size,
43  size_t max_lakes, size_t nvillages, size_t castle_size, size_t nplayers,
44  bool roads_between_castles, std::map<map_location,std::string>* labels,
45  const config& cfg);
46 private:
47 
48  typedef std::vector<std::vector<int> > height_map;
50 
51  bool generate_river_internal(const height_map& heights,
52  terrain_map& terrain, int x, int y, std::vector<map_location>& river,
53  std::set<map_location>& seen_locations, int river_uphill);
54 
55  std::vector<map_location> generate_river(const height_map& heights, terrain_map& terrain, int x, int y, int river_uphill);
56 
57  height_map generate_height_map(size_t width, size_t height,
58  size_t iterations, size_t hill_size,
59  size_t island_size, size_t island_off_center);
60 
61  bool generate_lake(t_translation::t_map& terrain, int x, int y, int lake_fall_off, std::set<map_location>& locs_touched);
62  map_location random_point_at_side(size_t width, size_t height);
64  std::string* base_name=nullptr,
65  utils::string_map* additional_symbols=nullptr);
66 
67  boost::random::mt19937 rng_;
68 
69 };
70 #endif
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.
std::vector< map_location > generate_river(const height_map &heights, terrain_map &terrain, int x, int y, int river_uphill)
boost::uint32_t uint32_t
Definition: xbrz.hpp:45
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
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< std::vector< t_terrain > > t_map
Definition: translation.hpp:76
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.
std::map< std::string, t_string > string_map
std::string base_name(const std::string &file)
Returns the base filename of a file, with directory name stripped.
static const ::config * terrain
The terrain used to create the cache.
Definition: minimap.cpp:135
Templates and utility-routines for strings and numbers.
Encapsulates the map of the game.
Definition: location.hpp:38
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Definition: glew.h:1220
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.
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.
GLint GLint GLint GLint GLint GLint GLsizei width
Definition: glew.h:1220
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
GLsizei const GLcharARB ** string
Definition: glew.h:4503
std::vector< std::vector< int > > height_map
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)