20 #define GETTEXT_DOMAIN "wesnoth-editor"
81 std::set<std::string> group_names;
83 if(group_names.count(group[
"id"]) == 0) {
85 group_cfg[
"id"] = group[
"id"];
86 group_cfg[
"name"] = group[
"name"];
88 group_cfg[
"icon"] = group[
"icon"].str();
89 group_cfg[
"core"] = group[
"core"];
90 groups_.emplace_back(group_cfg);
92 group_names.insert(
groups_.back().id);
96 if(group_names.count(group[
"id"]) == 0) {
98 group_cfg[
"id"] = group[
"id"];
99 group_cfg[
"name"] = group[
"name"];
101 group_cfg[
"icon"] =
"icons/terrain/terrain_" + group[
"icon"].str();
102 group_cfg[
"core"] = group[
"core"];
103 groups_.emplace_back(group_cfg);
105 group_names.insert(
groups_.back().id);
109 std::map<std::string, item_group*> id_to_group;
111 id_to_group.emplace(group.id, &group);
118 DBG_ED <<
"Palette: processing terrain " << t_info.
name()
119 <<
"(editor name: '" << t_info.
editor_name() <<
"') "
120 <<
"(" << t_info.
number() <<
")"
134 for (
const std::string& k : keys) {
137 if (
i != id_to_group.end()) {
138 if (
i->second->core) {
163 ERR_ED <<
"No items found.";
171 std::stringstream& tooltip_text)
176 if(
info.has_default_base()) {
177 const std::string base_filename =
info.editor_image();
181 tooltip_text <<
"BASE IMAGE NOT FOUND\n";
182 ERR_ED <<
"image for terrain : '" << base_filename <<
"' not found";
185 ERR_ED <<
"Placeholder image not found";
194 tooltip_text <<
"IMAGE NOT FOUND\n";
198 ERR_ED <<
"Placeholder image not found";
223 std::ostringstream
msg;
230 msg <<
_(
"Shift + left-click: paint overlay layer only") <<
" | ";
232 msg <<
_(
"Shift + left-click: paint base layer only") <<
" | ";
235 msg <<
_(
"Cmd + click: copy terrain") << std::endl;
237 msg <<
_(
"Ctrl + click: copy terrain") << std::endl;
A config object defines a single node in a WML file, with access to child nodes.
@ DEBUG_TERRAIN_CODES
Overlays terrain codes on tiles.
bool debug_flag_set(DEBUG_FLAG flag) const
const editor_map & get_map() const
std::set< std::string > non_core_items_
std::vector< item_group > groups_
The editor_groups as defined in editor-groups.cfg.
virtual void select_bg_item(const std::string &item_id) override
const std::vector< std::string > & active_group()
std::map< std::string, std::vector< std::string > > group_map_
virtual void select_fg_item(const std::string &item_id) override
Select a foreground item.
void set_group(std::size_t index) override
terrain_palette(editor_display &gui, editor_toolkit &toolkit)
void select_fg_item(const t_translation::terrain_code &terrain)
virtual void setup_item(const t_translation::terrain_code &item, texture &item_base_image, texture &item_overlay_image, std::stringstream &tooltip) override
Setup item image and tooltip.
virtual void setup(const game_config_view &cfg) override
Setup the internal data structure.
const t_translation::terrain_code & selected_bg_item() const
virtual const std::string & get_id(const t_translation::terrain_code &terrain) override
virtual std::string get_help_string() const override
const t_translation::terrain_code & selected_fg_item() const
void select_bg_item(const t_translation::terrain_code &terrain)
A class grating read only view to a vector of config objects, viewed as one config with all children ...
config_array_view child_range(config_key_type key) const
const t_translation::ter_list & get_terrain_list() const
Gets the list of terrains.
std::string get_terrain_editor_string(const map_location &loc) const
const terrain_type & get_terrain_info(const t_translation::terrain_code &terrain) const
const std::string & editor_group() const
const t_string & name() const
bool is_combined() const
True for instances created by the terrain_code(base, overlay) constructor.
const std::string & id() const
const t_string & editor_name() const
bool hide_in_editor() const
t_translation::terrain_code number() const
Wrapper class to encapsulate creation and management of an SDL_Texture.
static std::string _(const char *str)
Manage the empty-palette in the editor.
static bool is_valid_terrain(const t_translation::terrain_code &c)
const t_translation::terrain_code & get_selected_bg_terrain()
const t_translation::terrain_code & get_selected_fg_terrain()
const std::string unicode_em_dash
texture get_texture(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image texture suitable for hardware-accelerated rendering.
const terrain_code VOID_TERRAIN
VOID_TERRAIN is used for shrouded hexes.
std::vector< terrain_code > ter_list
const terrain_code FOGGED
std::vector< std::string > split(const config_attribute_value &val)
std::string::const_iterator iterator
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
std::string filename
Filename.
Stores the info about the groups in a nice format.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...