diff --git a/src/xrGame/ui/UITalkDialogWnd.cpp b/src/xrGame/ui/UITalkDialogWnd.cpp index f1062084b8c..e5af285d71e 100644 --- a/src/xrGame/ui/UITalkDialogWnd.cpp +++ b/src/xrGame/ui/UITalkDialogWnd.cpp @@ -147,10 +147,11 @@ void CUITalkDialogWnd::InitTalkDialogWnd() } } -void CUITalkDialogWnd::Show() +void CUITalkDialogWnd::Show(const bool notify_scripts /*= true*/) { InventoryUtilities::SendInfoToActor("ui_talk_show"); - InventoryUtilities::SendInfoToLuaScripts("ui_talk_show"); + if (notify_scripts) + InventoryUtilities::SendInfoToLuaScripts("ui_talk_show"); inherited::Show(true); inherited::Enable(true); @@ -159,12 +160,13 @@ void CUITalkDialogWnd::Show() UI().Focus().LockToWindow(UIQuestionsList); } -void CUITalkDialogWnd::Hide() +void CUITalkDialogWnd::Hide(const bool notify_scripts /*= true*/) { if (UI().Focus().GetLocker() == UIQuestionsList) UI().Focus().Unlock(); InventoryUtilities::SendInfoToActor("ui_talk_hide"); - InventoryUtilities::SendInfoToLuaScripts("ui_talk_hide"); + if (notify_scripts) + InventoryUtilities::SendInfoToLuaScripts("ui_talk_hide"); inherited::Show(false); inherited::Enable(false); g_btnHint->Discard(); diff --git a/src/xrGame/ui/UITalkDialogWnd.h b/src/xrGame/ui/UITalkDialogWnd.h index ace31438e26..b2d1e91f64a 100644 --- a/src/xrGame/ui/UITalkDialogWnd.h +++ b/src/xrGame/ui/UITalkDialogWnd.h @@ -26,8 +26,8 @@ class CUITalkDialogWnd final : public CUIWindow, public CUIWndCallback virtual void SendMessage(CUIWindow* pWnd, s16 msg, void* pData = NULL); - virtual void Show(); - virtual void Hide(); + virtual void Show(bool notify_scripts = true); + virtual void Hide(bool notify_scripts = true); CUITalkWnd* m_pParent; u32 GetHeaderColor() { return m_iNameTextColor; } CGameFont* GetHeaderFont() { return m_pNameTextFont; } diff --git a/src/xrGame/ui/UITalkWnd.cpp b/src/xrGame/ui/UITalkWnd.cpp index 6e20f333454..55b96a705a7 100644 --- a/src/xrGame/ui/UITalkWnd.cpp +++ b/src/xrGame/ui/UITalkWnd.cpp @@ -339,7 +339,9 @@ void CUITalkWnd::SwitchToUpgrade() CUIGameSP* pGameSP = smart_cast(CurrentGameUI()); if (pGameSP) { - UITalkDialogWnd->Hide(); + // Don't notify scripts that we are hiding the dialog because the CoC inventory_upgrade script will mess up otherwise. + // See: https://github.com/OpenXRay/xray-16/issues/1852 + UITalkDialogWnd->Hide(false); StopSnd(); pGameSP->StartUpgrade(m_pOurInvOwner, m_pOthersInvOwner);