From 20373acf682b50e3cd650c8788b582e3e9fc8fc6 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 30 Apr 2025 13:38:33 -0500 Subject: [PATCH] pass parent to preview dialog --- src/dialogxml/dialogs/3choice.cpp | 8 ++++---- src/dialogxml/dialogs/3choice.hpp | 4 ++-- src/scenedit/scen.keydlgs.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dialogxml/dialogs/3choice.cpp b/src/dialogxml/dialogs/3choice.cpp index 07529ddd..fe45e1df 100644 --- a/src/dialogxml/dialogs/3choice.cpp +++ b/src/dialogxml/dialogs/3choice.cpp @@ -174,14 +174,14 @@ std::string cThreeChoice::show(){ return "**ERROR**"; // shouldn't be reached } -short custom_choice_dialog(std::array& strs,short pic_num,ePicType pic_type,std::array& buttons,bool anim_pict,short anim_loops, int anim_fps) { +short custom_choice_dialog(std::array& strs,short pic_num,ePicType pic_type,std::array& buttons,bool anim_pict,short anim_loops, int anim_fps, cDialog* parent) { set_cursor(sword_curs); std::vector vec(strs.begin(), strs.end()); // Strip off trailing empty strings while(!vec.empty() && vec.back().empty()) vec.pop_back(); - cThreeChoice customDialog(vec, buttons, pic_num, pic_type); + cThreeChoice customDialog(vec, buttons, pic_num, pic_type, parent); if(anim_pict) setup_dialog_pict_anim(*(customDialog.operator->()), "pict", anim_loops, anim_fps); @@ -195,7 +195,7 @@ short custom_choice_dialog(std::array& strs,short pic_num,ePicTy return -1; } -short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type) { +short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type, cDialog* parent) { std::array strs; std::array buttons = {-1,-1,-1}; @@ -220,5 +220,5 @@ short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type) { showError("Dialog box ended up with no buttons."); return -1; } - return custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons, true, spec.ex1c, spec.ex2c); + return custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons, true, spec.ex1c, spec.ex2c, parent); } \ No newline at end of file diff --git a/src/dialogxml/dialogs/3choice.hpp b/src/dialogxml/dialogs/3choice.hpp index 5c5bb283..281222be 100644 --- a/src/dialogxml/dialogs/3choice.hpp +++ b/src/dialogxml/dialogs/3choice.hpp @@ -75,7 +75,7 @@ public: std::string show(); }; -short custom_choice_dialog(std::array& strs,short pic_num,ePicType pic_type,std::array& buttons, bool anim_pict = false, short anim_loops = -1, int anim_fps = -1); -short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type); +short custom_choice_dialog(std::array& strs,short pic_num,ePicType pic_type,std::array& buttons, bool anim_pict = false, short anim_loops = -1, int anim_fps = -1, cDialog* parent = nullptr); +short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type, cDialog* parent = nullptr); #endif diff --git a/src/scenedit/scen.keydlgs.cpp b/src/scenedit/scen.keydlgs.cpp index e359360d..cd497283 100644 --- a/src/scenedit/scen.keydlgs.cpp +++ b/src/scenedit/scen.keydlgs.cpp @@ -51,7 +51,7 @@ static bool preview_spec_enc_dlog(cDialog& me, std::string item_hit, cSpecial& s switch(special.type){ case eSpecType::ONCE_DIALOG: - once_dialog(univ, special, cur_type); + once_dialog(univ, special, cur_type, &me); break; default: break;