16 #define GETTEXT_DOMAIN "wesnoth-lib"
28 #define DBG_NG LOG_STREAM(debug, log_engine)
31 const int max_island = 10;
36 : width(std::max(0, cfg[
"map_width"].to_int(40)))
37 , height(std::max(0, cfg[
"map_height"].to_int(40)))
38 , default_width(width)
39 , default_height(height)
40 , nplayers(std::max(0, cfg[
"players"].to_int(2)))
41 , nvillages(std::max(0, cfg[
"villages"].to_int(25)))
42 , iterations(std::max(0, cfg[
"iterations"].to_int(1000)))
43 , hill_size(std::max(0, cfg[
"hill_size"].to_int(10)))
44 , castle_size(std::max(0, cfg[
"castle_size"].to_int(9)))
45 , island_size(std::max(0, cfg[
"island_size"].to_int(0)))
46 , island_off_center(0)
47 , max_lakes(std::max(0, cfg[
"max_lakes"].to_int(20)))
63 gui2::dialogs::generator_settings::execute(
data_);
127 DBG_NG <<
"calculated coastal params...";
134 std::map<map_location,std::string> labels_copy;
135 std::map<map_location,std::string>* labels_ptr = labels ? &labels_copy :
nullptr;
141 std::string error_message;
145 labels_copy = *labels;
156 }
while(tries && map.empty());
159 labels->swap(labels_copy);
162 if(!error_message.empty()) {
171 DBG_NG <<
"creating scenario...";
175 DBG_NG <<
"got scenario data...";
177 std::map<map_location,std::string> labels;
178 DBG_NG <<
"generating map...";
184 res[
"map_data"] =
"";
185 res[
"error_message"] = exc.
message;
187 DBG_NG <<
"done generating map..";
189 for(std::map<map_location,std::string>::const_iterator
i =
190 labels.begin();
i != labels.end(); ++
i) {
192 if(
i->first.x >= 0 &&
i->first.y >= 0 &&
197 label[
"text"] =
i->second;
198 label[
"category"] =
_(
"Villages");
A config object defines a single node in a WML file, with access to child nodes.
const config & child_or_empty(config_key_type key) const
Returns the first child with the given key, or an empty config if there is none.
optional_config_impl< config > optional_child(config_key_type key, int n=0)
Equivalent to mandatory_child, but returns an empty optional if the nth child was not found.
config & add_child(config_key_type key)
std::string default_generate_map(generator_data data, std::map< map_location, std::string > *labels, const config &cfg)
Generate the map.
std::string config_name() const override
Return a friendly name for the generator used to differentiate between different configs of the same ...
default_map_generator(const config &game_config)
bool allow_user_config() const override
Returns true if the map generator has an interactive screen, which allows the user to modify how the ...
config create_scenario(utils::optional< uint32_t > randomseed) override
void user_config() override
Display the interactive screen, which allows the user to modify how the generator behaves.
std::string create_map(utils::optional< uint32_t > randomseed) override
Creates a new map and returns it.
std::string name() const override
Returns a string identifying the generator by name.
std::string generate_map(std::map< map_location, std::string > *labels, utils::optional< uint32_t > randomseed)
static lg::log_domain log_engine("engine")
static std::string _(const char *str)
std::string label
What to show in the filter's drop-down list.
Standard logging facilities (interface).
constexpr bool is_odd(T num)