19 #define GETTEXT_DOMAIN "wesnoth-editor"
79 std::set<std::string> group_names;
82 if (group_names.find(
group[
"id"]) == group_names.end()) {
85 cfg[
"id"] =
group[
"id"];
86 cfg[
"name"] =
group[
"name"];
88 cfg[
"icon"] =
"icons/terrain/terrain_" +
group[
"icon"].str();
89 cfg[
"core"] =
group[
"core"];
92 group_names.insert(
groups_.back().id);
96 std::map<std::string, item_group*> id_to_group;
98 id_to_group.insert(std::make_pair(
group.id, &
group));
105 DBG_ED <<
"Palette: processing terrain " << t_info.
name()
106 <<
"(editor name: '" << t_info.
editor_name() <<
"') "
107 <<
"(" << t_info.
number() <<
")"
125 if (i != id_to_group.end()) {
126 if (i->second->core) {
152 ERR_ED <<
"No items found." << std::endl;
167 if(base_image ==
nullptr) {
168 tooltip_text <<
"BASE IMAGE NOT FOUND\n";
169 ERR_ED <<
"image for terrain : '" << base_filename <<
"' not found" << std::endl;
171 if (base_image ==
nullptr) {
172 ERR_ED <<
"Placeholder image not found" << std::endl;
185 if(image ==
nullptr) {
186 tooltip_text <<
"IMAGE NOT FOUND\n";
187 ERR_ED <<
"image for terrain: '" << filename <<
"' not found" << std::endl;
189 if (image ==
nullptr) {
190 ERR_ED <<
"Placeholder image not found" << std::endl;
221 std::ostringstream
msg;
surface get_image(const image::locator &i_locator, TYPE type)
function to get the surface corresponding to an image.
child_itors child_range(const std::string &key)
virtual void select_bg_item(const std::string &item_id)
const t_translation::t_terrain & selected_bg_item() const
terrain_palette(editor_display &gui, const config &cfg, mouse_action **active_mouse_action)
virtual void select_fg_item(const std::string &item_id)
Select a foreground item.
bool get_draw_terrain_codes() const
Getter for the terrain code debug overlay on tiles.
Stores the info about the groups in a nice format.
std::string get_terrain_editor_string(const map_location &loc) const
const t_translation::t_list & get_terrain_list() const
Gets the list of terrains.
const t_terrain NONE_TERRAIN
bool hide_in_editor() const
const t_string & name() const
const std::string & id() const
const std::vector< std::string > & active_group()
const std::vector< std::string > items
surface scale_surface(const surface &surf, int w, int h)
virtual void setup(const config &cfg)
Setup the internal data structure.
const std::string & editor_group() const
const t_string & editor_name() const
const gamemap & map() const
const t_translation::t_terrain & selected_fg_item() const
virtual std::string get_help_string()
static UNUSEDNOWARN std::string _(const char *str)
std::map< std::string, std::vector< std::string > > group_map_
const std::string & editor_image() const
t_translation::t_terrain number() const
const std::string unicode_em_dash
t_translation::t_terrain default_base() const
Manage the empty-palette in the editor.
static const ::config * terrain
The terrain used to create the cache.
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::t_terrain &terrain) const
void select_fg_item(const t_translation::t_terrain &terrain)
const t_translation::t_terrain & get_selected_bg_terrain()
void select_bg_item(const t_translation::t_terrain &terrain)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
std::set< std::string > non_core_items_
virtual void draw_item(const t_translation::t_terrain &terrain, surface &item_image, std::stringstream &tooltip_text)
const t_terrain VOID_TERRAIN
static bool is_valid_terrain(const t_translation::t_terrain &c)
this module manages the cache of images.
void assign(const surface &o)
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
std::vector< item_group > groups_
The editor_groups as defined in editor-groups.cfg.
A mouse action receives events from the controller, and responds to them by creating an appropriate e...
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
virtual const std::string & get_id(const t_translation::t_terrain &terrain)
std::vector< t_terrain > t_list
const t_translation::t_terrain & get_selected_fg_terrain()
void set_group(size_t index)