From d5ebad4e74da011777f9ba1a13fbb37d18c827b9 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 4 Mar 2024 17:48:35 +0100 Subject: Added support for handling SMSG_NPC_COMMAND This only adds support for the NPC_CLOSE_DIALOG and NPC_CLEAR_DIALOG sub-commands. Closes #47 --- src/gui/npcdialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/gui') diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 0ad9e959..4efa29eb 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -586,6 +586,11 @@ void NpcEventListener::event(Event::Channel channel, dialog->showNextButton(); } + else if (event.getType() == Event::ClearDialog) + { + if (NpcDialog *dialog = getDialog(event.getInt("id"), false)) + dialog->setText(std::string()); + } else if (event.getType() == Event::Close) { int id = event.getInt("id"); @@ -600,6 +605,11 @@ void NpcEventListener::event(Event::Channel channel, dialog->showCloseButton(); } + else if (event.getType() == Event::CloseDialog) + { + if (NpcDialog *dialog = getDialog(event.getInt("id"), false)) + dialog->setVisible(false); + } else if (event.getType() == Event::CloseAll) { NpcDialog::closeAll(); -- cgit v1.2.3-70-g09d2