19 #define GETTEXT_DOMAIN "wesnoth-editor" 79 std::set<std::string> group_names;
81 if(group_names.count(group[
"id"]) == 0) {
83 group_cfg[
"id"] = group[
"id"];
84 group_cfg[
"name"] = group[
"name"];
86 group_cfg[
"icon"] = group[
"icon"].str();
87 group_cfg[
"core"] = group[
"core"];
88 groups_.emplace_back(group_cfg);
90 group_names.insert(
groups_.back().id);
94 if(group_names.count(group[
"id"]) == 0) {
96 group_cfg[
"id"] = group[
"id"];
97 group_cfg[
"name"] = group[
"name"];
99 group_cfg[
"icon"] =
"icons/terrain/terrain_" + group[
"icon"].str();
100 group_cfg[
"core"] = group[
"core"];
101 groups_.emplace_back(group_cfg);
103 group_names.insert(
groups_.back().id);
107 std::map<std::string, item_group*> id_to_group;
109 id_to_group.emplace(group.id, &group);
116 DBG_ED <<
"Palette: processing terrain " << t_info.
name()
117 <<
"(editor name: '" << t_info.
editor_name() <<
"') " 118 <<
"(" << t_info.
number() <<
")" 132 for (
const std::string& k : keys) {
136 if (i != id_to_group.end()) {
137 if (i->second->core) {
163 ERR_ED <<
"No items found." << std::endl;
177 if(base_image ==
nullptr) {
178 tooltip_text <<
"BASE IMAGE NOT FOUND\n";
179 ERR_ED <<
"image for terrain : '" << base_filename <<
"' not found" << std::endl;
181 if(base_image ==
nullptr) {
182 ERR_ED <<
"Placeholder image not found" << std::endl;
195 if(image ==
nullptr) {
196 tooltip_text <<
"IMAGE NOT FOUND\n";
197 ERR_ED <<
"image for terrain: '" << filename <<
"' not found" << std::endl;
199 if(image ==
nullptr) {
200 ERR_ED <<
"Placeholder image not found" << std::endl;
230 std::ostringstream
msg;
surface get_image(const image::locator &i_locator, TYPE type)
function to get the surface corresponding to an image.
virtual const std::string & get_id(const t_translation::terrain_code &terrain)
const t_translation::terrain_code & get_selected_bg_terrain()
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
const t_translation::ter_list & get_terrain_list() const
Gets the list of terrains.
child_itors child_range(config_key_type key)
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
virtual void setup(const config &cfg)
Setup the internal data structure.
const t_translation::terrain_code & get_selected_fg_terrain()
std::vector< std::string > split(const std::string &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
const terrain_code VOID_TERRAIN
void select_bg_item(const t_translation::terrain_code &terrain)
virtual std::string get_help_string()
static UNUSEDNOWARN std::string _(const char *str)
const t_string & editor_name() const
t_translation::terrain_code default_base() const
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)
static const ::config * terrain
The terrain used to create the cache.
std::string get_terrain_editor_string(const map_location &loc) const
terrain_palette(editor_display &gui, const config &cfg, editor_toolkit &toolkit)
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_
void assign(SDL_Surface *surf)
const std::string unicode_em_dash
this module manages the cache of images.
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