19 #define GETTEXT_DOMAIN "wesnoth-editor" 80 std::set<std::string> group_names;
82 if(group_names.count(group[
"id"]) == 0) {
84 group_cfg[
"id"] = group[
"id"];
85 group_cfg[
"name"] = group[
"name"];
87 group_cfg[
"icon"] = group[
"icon"].str();
88 group_cfg[
"core"] = group[
"core"];
89 groups_.emplace_back(group_cfg);
91 group_names.insert(
groups_.back().id);
95 if(group_names.count(group[
"id"]) == 0) {
97 group_cfg[
"id"] = group[
"id"];
98 group_cfg[
"name"] = group[
"name"];
100 group_cfg[
"icon"] =
"icons/terrain/terrain_" + group[
"icon"].str();
101 group_cfg[
"core"] = group[
"core"];
102 groups_.emplace_back(group_cfg);
104 group_names.insert(
groups_.back().id);
108 std::map<std::string, item_group*> id_to_group;
110 id_to_group.emplace(group.id, &group);
117 DBG_ED <<
"Palette: processing terrain " << t_info.
name()
118 <<
"(editor name: '" << t_info.
editor_name() <<
"') " 119 <<
"(" << t_info.
number() <<
")" 133 for (
const std::string& k : keys) {
137 if (i != id_to_group.end()) {
138 if (i->second->core) {
164 ERR_ED <<
"No items found." << std::endl;
178 if(base_image ==
nullptr) {
179 tooltip_text <<
"BASE IMAGE NOT FOUND\n";
180 ERR_ED <<
"image for terrain : '" << base_filename <<
"' not found" << std::endl;
182 if(base_image ==
nullptr) {
183 ERR_ED <<
"Placeholder image not found" << std::endl;
196 if(image ==
nullptr) {
197 tooltip_text <<
"IMAGE NOT FOUND\n";
198 ERR_ED <<
"image for terrain: '" << filename <<
"' not found" << std::endl;
200 if(image ==
nullptr) {
201 ERR_ED <<
"Placeholder image not found" << std::endl;
230 std::ostringstream
msg;
237 msg <<
_(
"Shift + left-click: paint overlay layer only") <<
" | ";
239 msg <<
_(
"Shift + left-click: paint base layer only") <<
" | ";
242 msg <<
_(
"Cmd + click: copy terrain") << std::endl;
244 msg <<
_(
"Ctrl + click: copy terrain") << std::endl;
surface get_image(const image::locator &i_locator, TYPE type)
Caches and returns an image.
virtual const std::string & get_id(const t_translation::terrain_code &terrain)
const t_translation::terrain_code & get_selected_bg_terrain()
terrain_palette(editor_display &gui, const game_config_view &cfg, editor_toolkit &toolkit)
const terrain_code NONE_TERRAIN
virtual void select_fg_item(const std::string &item_id) override
Select a foreground item.
const gamemap & map() const
Stores the info about the groups in a nice format.
virtual void select_bg_item(const std::string &item_id) override
config_array_view child_range(config_key_type key) const
const t_translation::ter_list & get_terrain_list() const
Gets the list of terrains.
void set_group(std::size_t index) override
const t_translation::terrain_code & selected_bg_item() const
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
const terrain_type & get_terrain_info(const t_translation::terrain_code &terrain) const
const std::vector< std::string > & active_group()
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
const std::vector< std::string > items
surface scale_surface(const surface &surf, int w, int h)
Scale a surface using alpha-weighted modified bilinear filtering Note: causes artifacts with alpha gr...
const std::string & editor_image() const
static std::string _(const char *str)
const t_translation::terrain_code & get_selected_fg_terrain()
const terrain_code VOID_TERRAIN
VOID_TERRAIN is used for shrouded hexes.
void select_bg_item(const t_translation::terrain_code &terrain)
virtual std::string get_help_string()
const t_string & editor_name() const
t_translation::terrain_code default_base() const
bool is_combined() const
True for instances created by the terrain_code(base, overlay) constructor.
const terrain_code FOGGED
std::map< std::string, std::vector< std::string > > group_map_
Manage the empty-palette in the editor.
void select_fg_item(const t_translation::terrain_code &terrain)
std::string get_terrain_editor_string(const map_location &loc) const
t_translation::terrain_code number() const
static bool is_valid_terrain(const t_translation::terrain_code &c)
bool hide_in_editor() const
const t_string & name() const
std::set< std::string > non_core_items_
virtual void setup(const game_config_view &cfg)
Setup the internal data structure.
std::vector< std::string > split(const config_attribute_value &val)
const std::string unicode_em_dash
Functions to load and save images from/to disk.
const std::string & id() const
std::vector< terrain_code > ter_list
virtual void draw_item(const t_translation::terrain_code &terrain, surface &item_image, std::stringstream &tooltip_text)
const t_translation::terrain_code & selected_fg_item() const
std::vector< item_group > groups_
The editor_groups as defined in editor-groups.cfg.
bool get_draw_terrain_codes() const
Getter for the terrain code debug overlay on tiles.
A config object defines a single node in a WML file, with access to child nodes.
std::string::const_iterator iterator
const std::string & editor_group() const