15 #define GETTEXT_DOMAIN "wesnoth-lib"
32 constexpr
int max_coastal = 5;
33 constexpr
int extra_size_per_player = 2;
34 constexpr
int min_size = 20;
36 std::string get_village_description(
int count)
38 return VGETTEXT(
"$count/1000 tiles", {{
"count", std::to_string(count)}});
41 std::string get_landform_description(
int count)
43 return count == 0 ?
_(
"Inland") : (count < max_coastal ?
_(
"Coastal") :
_(
"Island"));
52 , players_(register_integer("players", true,
data.nplayers))
53 , width_(register_integer("width", true,
data.width))
54 , height_(register_integer("height", true,
data.height))
56 register_integer(
"hills_num",
true,
data.iterations);
57 register_integer(
"hills_size",
true,
data.hill_size);
58 register_integer(
"villages",
true,
data.nvillages);
59 register_integer(
"castle_size",
true,
data.castle_size);
60 register_integer(
"landform",
true,
data.island_size);
62 register_bool(
"connect_castles",
true,
data.link_castles);
63 register_bool(
"show_labels",
true,
data.show_labels);
79 [](
const slider&
s) {
return get_village_description(
s.get_value()); });
81 [](
const slider&
s) {
return get_landform_description(
s.get_value()); });
93 w.set_value_range(min_size + extra_size,
w.get_maximum_value());
96 update_dimension_slider(
width_);
97 update_dimension_slider(
height_);
virtual void pre_show() override
The execute function.
void adjust_minimum_size_by_players()
field_integer * players_
We need to own these fields to access the underlying widget.
Abstract base class for all modal dialogs.
styled_widget * get_widget()
Template class to implement the generic field implementation.
T get_widget_value()
Gets the value of the field.
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed.
static std::string _(const char *str)
REGISTER_DIALOG(editor_edit_unit)
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
void bind_default_status_label(W &source)
Binds a status label using the default value getter and default target ID.
void bind_status_label(W &source, const F &value_getter, styled_widget *target_ptr=nullptr)
Binds a given target widget to reflect another widget's label.
static map_location::direction s