33 #define WRN_NG LOG_STREAM(warn, log_engine)
34 #define LOG_NG LOG_STREAM(info, log_engine)
61 WRN_NG <<
"Trying to remove non-existent menu item '" <<
id <<
"'; ignoring." << std::endl;
67 iter->second->finish_handler();
85 if ( iter ==
end() ) {
96 if ( wmi.
can_show(hex, gamedata, fc) ) {
112 std::vector<std::pair<boost::shared_ptr<const wml_menu_item>,
std::string> > ret;
123 for (
const item_ptr & item : std::make_pair (start, finish))
129 ret.push_back(std::make_pair(item, item->menu_text()));
149 unsigned wmi_count = 0;
152 for (
const item_ptr & wmi : *
this) {
160 if ( wmi_count > 0 ) {
161 LOG_NG << wmi_count <<
" WML menu items found, loaded." << std::endl;
171 item->to_config(cfg.
add_child(
"menu_item"));
184 if ( add_it->second )
187 add_it->second.reset(
new wml_menu_item(
id, menu_item, *add_it->second));
201 if(!item.has_attribute(
"id")){
continue; }
208 WRN_NG <<
"duplicate menu item (" <<
id <<
") while loading from config" << std::endl;
play_controller * controller
child_itors child_range(const std::string &key)
static lg::log_domain log_engine("engine")
bool empty() const
Returns true if *this contains no data.
bool fire_item(const std::string &id, const map_location &hex, game_data &gamedata, filter_context &fc, unit_map &units) const
Fires the menu item with the given id.
bool can_use_synced_wml_menu() const
Definitions for the interface to Wesnoth Markup Language (WML).
iterator find(const std::string &id)
Returns an iterator to a menu item with the given id, if one exists.
config::attribute_value & get_variable(const std::string &varname)
throws invalid_variablename_exception if varname is no valid variable name.
map_t::size_type size_type
void to_config(config &cfg) const
boost::shared_ptr< wml_menu_item > item_ptr
Pointers to our elements.
config & add_child(const std::string &key)
void set_menu_items(const config &cfg)
Sets the current menu items to the "menu_item" children of cfg.
~wmi_container()
Destructor.
Encapsulates the map of the game.
Declarations for a container for wml_menu_item.
std::vector< std::pair< boost::shared_ptr< const wml_menu_item >, std::string > > get_items(const map_location &hex, game_data &gamedata, filter_context &fc, unit_map &units, const_iterator start, const_iterator finish) const
Returns the menu items that can be shown for the given location.
Define the handlers for the game's events mechanism.
void init_handlers() const
Initializes the implicit event handlers for inlined [command]s.
A variable-expanding proxy for the config class.
Standard logging facilities (interface).
Container associating units to locations.
void set_item(const std::string &id, const vconfig &menu_item)
Updates or creates (as appropriate) the menu item with the given id.
This is a const_iterator class that extends an existing const_iterator by overriding dereference...
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
size_type erase(const std::string &id)
Erases the item with the provided id.