summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/npcdialog.cpp33
-rw-r--r--src/gui/npcdialog.h8
2 files changed, 11 insertions, 30 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 376813f7..be076fc5 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -330,16 +330,9 @@ bool NpcDialog::isInputFocused() const
bool NpcDialog::isAnyInputFocused()
{
- auto it = instances.begin();
- auto it_end = instances.end();
-
- for (; it != it_end; it++)
- {
- if ((*it)->isInputFocused())
- {
+ for (auto dialog : instances)
+ if (dialog->isInputFocused())
return true;
- }
- }
return false;
}
@@ -415,29 +408,17 @@ NpcDialog *NpcDialog::getActive()
if (instances.size() == 1)
return instances.front();
- auto it = instances.begin();
- auto it_end = instances.end();
-
- for (; it != it_end; it++)
- {
- if ((*it)->isFocused())
- {
- return (*it);
- }
- }
+ for (auto dialog : instances)
+ if (dialog->isFocused())
+ return dialog;
return nullptr;
}
void NpcDialog::closeAll()
{
- auto it = instances.begin();
- auto it_end = instances.end();
-
- for (; it != it_end; it++)
- {
- (*it)->close();
- }
+ for (auto dialog : instances)
+ dialog->close();
}
void NpcDialog::setup()
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h
index b902f044..42485766 100644
--- a/src/gui/npcdialog.h
+++ b/src/gui/npcdialog.h
@@ -46,10 +46,10 @@ class Button;
*
* \ingroup Interface
*/
-class NpcDialog : public Window,
- public gcn::ActionListener,
- public gcn::ListModel,
- public EventListener
+class NpcDialog final : public Window,
+ public gcn::ActionListener,
+ public gcn::ListModel,
+ public EventListener
{
public:
NpcDialog(int npcId);