diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/npcdialog.cpp | 13 | ||||
-rw-r--r-- | src/gui/npcdialog.h | 7 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index f4d99cc79..2271a0bc7 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -66,6 +66,7 @@ #define CAPTION_SUBMIT _("Submit") NpcDialog::DialogList NpcDialog::instances; +NpcDialogs NpcDialog::mNpcDialogs; typedef std::vector<Image *>::iterator ImageVectorIter; @@ -774,3 +775,15 @@ void NpcDialog::clearRows() { mTextBox->clearRows(); } + +void NpcDialog::clearDialogs() +{ + NpcDialogs::iterator it = mNpcDialogs.begin(); + const NpcDialogs::iterator it_end = mNpcDialogs.end(); + while (it != it_end) + { + delete (*it).second; + ++ it; + } + mNpcDialogs.clear(); +} diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index 3cdb39511..8a4e5b614 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -41,11 +41,14 @@ class BrowserBox; class ExtendedListBox; class ItemLinkHandler; class IntTextField; +class NpcDialog; class PlayerBox; class ScrollArea; class TextBox; class TextField; +typedef std::map<int, NpcDialog*> NpcDialogs; + /** * The npc dialog. * @@ -202,6 +205,10 @@ class NpcDialog final : public Window, void clearRows(); + static NpcDialogs mNpcDialogs; + + static void clearDialogs(); + private: typedef std::list<NpcDialog*> DialogList; static DialogList instances; |