Remove an unneeded "if" statement.
When a serach for an item with a given id returns something, then that something has the given id. There is no need to test that. Also added some documentation as to what the search is for.
This commit is contained in:
parent
01b65ff9ba
commit
40578f7bc9
2 changed files with 10 additions and 12 deletions
|
@ -78,7 +78,9 @@ public:
|
|||
void to_config(config& cfg);
|
||||
void set_menu_items(const config& cfg);
|
||||
|
||||
/// Returns an iterator to a menu item with the given @a id, if one exists.
|
||||
iterator find(const std::string & id) { return iterator(wml_menu_items_.find(id)); }
|
||||
/// Returns an iterator to a menu item with the given @a id, if one exists.
|
||||
const_iterator find(const std::string & id) const { return const_iterator(wml_menu_items_.find(id)); }
|
||||
/// Returns an item with the given id.
|
||||
wml_menu_item & get_item(const std::string& id);
|
||||
|
|
|
@ -825,19 +825,15 @@ bool play_controller::execute_command(const hotkey::hotkey_command& cmd, int ind
|
|||
game_events::wmi_container::iterator iter = gs_wmi.find(name);
|
||||
if(iter != gs_wmi.end())
|
||||
{
|
||||
//i think this is not needed, but i havent tested without yet.
|
||||
if(name == iter->id())
|
||||
{
|
||||
//copied from expand_wml_commands
|
||||
const map_location& hex = mouse_handler_.get_last_hex();
|
||||
gamedata_.get_variable("x1") = hex.x + 1;
|
||||
gamedata_.get_variable("y1") = hex.y + 1;
|
||||
scoped_xy_unit highlighted_unit("unit", hex.x, hex.y, units_);
|
||||
//copied from expand_wml_commands
|
||||
const map_location& hex = mouse_handler_.get_last_hex();
|
||||
gamedata_.get_variable("x1") = hex.x + 1;
|
||||
gamedata_.get_variable("y1") = hex.y + 1;
|
||||
scoped_xy_unit highlighted_unit("unit", hex.x, hex.y, units_);
|
||||
|
||||
if (iter->can_show(hex))
|
||||
{
|
||||
iter->fire_event(mouse_handler_.get_last_hex());
|
||||
}
|
||||
if (iter->can_show(hex))
|
||||
{
|
||||
iter->fire_event(mouse_handler_.get_last_hex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue