The Battle for Wesnoth  1.13.10+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 - 2017 by David White <dave@whitevine.net>
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 #pragma once
18 
19 class config;
20 
22 #include "map/location.hpp"
24 #include "terrain/translation.hpp"
25 #include "utils/name_generator.hpp"
26 
27 #include <random>
28 #include <cstdint>
29 #include <map>
30 #include <memory>
31 
33 {
34 public:
36  default_map_generator_job(uint32_t seed);
37 
38  /** Generate the map. */
39  std::string default_generate_map(generator_data data, std::map<map_location,std::string>* labels, const config& cfg);
40 
41 private:
42  typedef std::vector<std::vector<int> > height_map;
44 
45  bool generate_river_internal(const height_map& heights,
46  terrain_map& terrain, int x, int y, std::vector<map_location>& river,
47  std::set<map_location>& seen_locations, int river_uphill);
48 
49  std::vector<map_location> generate_river(const height_map& heights, terrain_map& terrain, int x, int y, int river_uphill);
50 
51  height_map generate_height_map(size_t width, size_t height,
52  size_t iterations, size_t hill_size,
53  size_t island_size, size_t island_off_center);
54 
55  bool generate_lake(t_translation::ter_map& terrain, int x, int y, int lake_fall_off, std::set<map_location>& locs_touched);
56  map_location random_point_at_side(size_t width, size_t height);
57 
58  std::mt19937 rng_;
60 
61 };
std::vector< char_t > string
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)
River generation.
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.
static const ::config * terrain
The terrain used to create the cache.
Definition: minimap.cpp:133
Encapsulates the map of the game.
Definition: location.hpp:40
std::string default_generate_map(generator_data data, std::map< map_location, std::string > *labels, const config &cfg)
Generate the map.
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.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
std::vector< map_location > generate_river(const height_map &heights, terrain_map &terrain, int x, int y, int river_uphill)
std::vector< std::vector< int > > height_map
bool generate_lake(t_translation::ter_map &terrain, int x, int y, int lake_fall_off, std::set< map_location > &locs_touched)
Generate a lake.