summaryrefslogtreecommitdiff
path: root/src/gui/mainmenumanager.h
diff options
context:
space:
mode:
authorBenjamin Lindley <benjameslindley@gmail.com>2019-03-05 01:13:15 -0600
committerLoïc Blot <nerzhul@users.noreply.github.com>2019-03-05 08:13:15 +0100
commite19565c170ba8baf7a90945beb44cb1ef7292e50 (patch)
tree137c0c9c6a4004b93a47a54d4d8c70ff11de3582 /src/gui/mainmenumanager.h
parent5d2624ab8271b490ed5c5eda8ca1e3ea677eadcc (diff)
downloadminetest-e19565c170ba8baf7a90945beb44cb1ef7292e50.tar.gz
minetest-e19565c170ba8baf7a90945beb44cb1ef7292e50.tar.bz2
minetest-e19565c170ba8baf7a90945beb44cb1ef7292e50.zip
Replace for loop with call to standard library function (#8194)
This loop makes multiple passes over m_stack (type std::list) in order to remove all elements with a specified value. Replacing the loop with a call to std::list::remove does the same job, but in only one pass.
Diffstat (limited to 'src/gui/mainmenumanager.h')
-rw-r--r--src/gui/mainmenumanager.h16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/gui/mainmenumanager.h b/src/gui/mainmenumanager.h
index ea9327813..102492255 100644
--- a/src/gui/mainmenumanager.h
+++ b/src/gui/mainmenumanager.h
@@ -62,21 +62,7 @@ public:
virtual void deletingMenu(gui::IGUIElement *menu)
{
// Remove all entries if there are duplicates
- bool removed_entry;
- do{
- removed_entry = false;
- for(std::list<gui::IGUIElement*>::iterator
- i = m_stack.begin();
- i != m_stack.end(); ++i)
- {
- if(*i == menu)
- {
- m_stack.erase(i);
- removed_entry = true;
- break;
- }
- }
- }while(removed_entry);
+ m_stack.remove(menu);
/*core::list<GUIModalMenu*>::Iterator i = m_stack.getLast();
assert(*i == menu);