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) {
138 if (i != id_to_group.end()) {
139 if (i->second->core) {
165 ERR_ED <<
"No items found." << std::endl;
179 if(base_image ==
nullptr) {
180 tooltip_text <<
"BASE IMAGE NOT FOUND\n";
181 ERR_ED <<
"image for terrain : '" << base_filename <<
"' not found" << std::endl;
183 if(base_image ==
nullptr) {
184 ERR_ED <<
"Placeholder image not found" << std::endl;
197 if(image ==
nullptr) {
198 tooltip_text <<
"IMAGE NOT FOUND\n";
199 ERR_ED <<
"image for terrain: '" << filename <<
"' not found" << std::endl;
201 if(image ==
nullptr) {
202 ERR_ED <<
"Placeholder image not found" << std::endl;
231 std::ostringstream
msg;
238 msg <<
_(
"Shift + left-click: paint overlay layer only") <<
" | ";
240 msg <<
_(
"Shift + left-click: paint base layer only") <<
" | ";
243 msg <<
_(
"Cmd + click: copy terrain") << std::endl;
245 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
const std::vector< std::string > items
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="")
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