From 531384844e981471b5f6a7ef1d82f7119533c376 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 5 Mar 2025 20:54:52 -0600 Subject: [PATCH] Better function name for cStack changeSelectedPage() --- src/dialogxml/widgets/stack.cpp | 2 +- src/dialogxml/widgets/stack.hpp | 2 +- src/game/boe.dlgutil.cpp | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/dialogxml/widgets/stack.cpp b/src/dialogxml/widgets/stack.cpp index f41783d1..d34ebe5d 100644 --- a/src/dialogxml/widgets/stack.cpp +++ b/src/dialogxml/widgets/stack.cpp @@ -85,7 +85,7 @@ bool cStack::setPage(size_t n) { return !failed; } -void cStack::doSelectPage(int dir, bool loop) { +void cStack::changeSelectedPage(int dir, bool loop) { curPage += dir; if(loop){ if(curPage < 0) curPage += nPages; diff --git a/src/dialogxml/widgets/stack.hpp b/src/dialogxml/widgets/stack.hpp index 53e8175b..c6d491e3 100644 --- a/src/dialogxml/widgets/stack.hpp +++ b/src/dialogxml/widgets/stack.hpp @@ -60,7 +60,7 @@ public: /// Page forward or backward in the stack /// @param dir Usually -1 or 1 /// @param loop Beyond the first and last page, loop to the other side - void doSelectPage(int dir, bool loop = true); + void changeSelectedPage(int dir, bool loop = true); /// Get the current page the stack is displaying. /// @return The current page number size_t getPage() const; diff --git a/src/game/boe.dlgutil.cpp b/src/game/boe.dlgutil.cpp index d42e348f..15f53950 100644 --- a/src/game/boe.dlgutil.cpp +++ b/src/game/boe.dlgutil.cpp @@ -1720,9 +1720,9 @@ class cChooseScenario { return true; } - bool doSelectPage(int dir) { + bool changeSelectedPage(int dir) { auto& stk = dynamic_cast(me["list"]); - stk.doSelectPage(dir, true); + stk.changeSelectedPage(dir, true); return true; } @@ -1762,8 +1762,8 @@ public: set_cursor(sword_curs); me["cancel"].attachClickHandler(std::bind(&cChooseScenario::doCancel, this)); - me["next"].attachClickHandler(std::bind(&cChooseScenario::doSelectPage, this, 1)); - me["prev"].attachClickHandler(std::bind(&cChooseScenario::doSelectPage, this, -1)); + me["next"].attachClickHandler(std::bind(&cChooseScenario::changeSelectedPage, this, 1)); + me["prev"].attachClickHandler(std::bind(&cChooseScenario::changeSelectedPage, this, -1)); me["start1"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 0)); me["start2"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 1)); me["start3"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 2)); @@ -2011,11 +2011,11 @@ class cFilePicker { return true; } - bool doSelectPage(int dir) { + bool changeSelectedPage(int dir) { auto& stk = dynamic_cast(me["list"]); // This stack doesn't loop. It's easier to implement loading the files one page at a time // if I know we're not gonna jump from page 0 to the last page, leaving a gap in the vector. - stk.doSelectPage(dir); + stk.changeSelectedPage(dir); me["prev"].show(); me["next"].show(); if(stk.getPage() == 0){ @@ -2089,8 +2089,8 @@ public: // when replaying, basically make Left/Right buttons no-op. // Load/Save buttons should send a dummy result. if(!replaying){ - me["next"].attachClickHandler(std::bind(&cFilePicker::doSelectPage, this, 1)); - me["prev"].attachClickHandler(std::bind(&cFilePicker::doSelectPage, this, -1)); + me["next"].attachClickHandler(std::bind(&cFilePicker::changeSelectedPage, this, 1)); + me["prev"].attachClickHandler(std::bind(&cFilePicker::changeSelectedPage, this, -1)); init_pages(); }else{ for(int i = 0; i < SLOTS_PER_PAGE; ++i){ @@ -2104,7 +2104,7 @@ public: } // Hide the prev button and populate the first page - doSelectPage(0); + changeSelectedPage(0); me.run(); if(!me.hasResult()) return "";