Skip to content

Commit

Permalink
Use variables for village density label
Browse files Browse the repository at this point in the history
(Who knows, maybe some language has its own standard way of displaying ratios!)
  • Loading branch information
CelticMinstrel committed Oct 24, 2018
1 parent 690098c commit eb8f667
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gui/dialogs/editor/generator_settings.cpp
Expand Up @@ -21,6 +21,7 @@
#include "gui/widgets/slider.hpp"
#include "gui/widgets/status_label_helper.hpp"
#include "gettext.hpp"
#include "formula/string_utils.hpp"

#include "utils/functional.hpp"

Expand Down Expand Up @@ -68,7 +69,12 @@ void generator_settings::pre_show(window& window)
// Do this *after* assigning the 'update_*_label_` functions or the game will crash!
adjust_minimum_size_by_players(window);

gui2::bind_status_label<slider>(&window, "villages", [](slider& s)->std::string { return formatter() << s.get_value() << _("/1000 tiles"); });
gui2::bind_status_label<slider>(&window, "villages", [](slider& s)->std::string {
std::string val = std::to_string(s.get_value());
utils::string_map args;
args["villages"] = val;
return VGETTEXT("$villages/1000 tiles", args);
});
gui2::bind_status_label<slider>(&window, "castle_size");
gui2::bind_status_label<slider>(&window, "landform", [](slider& s)->std::string {
return s.get_value() == 0 ? _("Inland") : (s.get_value() < max_coastal ? _("Coastal") : _("Island")); });
Expand Down

0 comments on commit eb8f667

Please sign in to comment.