From fdb2b0e0d8c7b26837681a0b2aded24d402eb00d Mon Sep 17 00:00:00 2001 From: ALONSO Laurent Date: Thu, 14 Oct 2021 15:51:19 +0200 Subject: [PATCH] dialog: do not open dialog centered at 0x0 Character Editor[skill]: do not always display help, there is an help button... --- src/dialogxml/dialogs/dialog.cpp | 4 ++-- src/pcedit/pc.editors.cpp | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/dialogxml/dialogs/dialog.cpp b/src/dialogxml/dialogs/dialog.cpp index 48cfd6a5..4edd4fe7 100644 --- a/src/dialogxml/dialogs/dialog.cpp +++ b/src/dialogxml/dialogs/dialog.cpp @@ -536,8 +536,8 @@ void cDialog::run(std::function onopen){ view.setViewport(sf::FloatRect(0, 0, ui_scale, ui_scale)); win.setView(view); - // ASAN overflow - win.setPosition({parentPos.x + (int(parentSz.x) - wWidth) / 2, parentPos.y + (int(parentSz.y) - wHeight) / 2}); + win.setPosition({std::max(0,parentPos.x + (int(parentSz.x) - wWidth) / 2), + std::max(0,parentPos.y + (int(parentSz.y) - wHeight) / 2)}); draw(); makeFrontWindow(parent ? parent-> win : mainPtr); makeFrontWindow(win); diff --git a/src/pcedit/pc.editors.cpp b/src/pcedit/pc.editors.cpp index 221fcabe..e895e73b 100644 --- a/src/pcedit/pc.editors.cpp +++ b/src/pcedit/pc.editors.cpp @@ -634,8 +634,6 @@ bool spend_xp(short pc_num, short mode, cDialog* parent) { xpDlog.attachClickHandlers(std::bind(spend_xp_navigate_filter,_1,_2,std::ref(save)),{"keep","cancel","left","right","help"}); xpDlog.attachClickHandlers(spend_xp_filter,{"sp-m","sp-p","hp-m","hp-p"}); - give_help(10,11,xpDlog); - xpDlog.run(); return xpDlog.getResult();