From 5c1fb4ad39da8bd7d6ccb37315047a113c992fef Mon Sep 17 00:00:00 2001 From: Justin Pridgen Date: Sat, 9 Mar 2024 19:02:58 -0500 Subject: [PATCH] v1.4.2 --- .gitattributes | 1 + .github/workflows/build.yml | 3 +++ changelog.md | 3 +++ mod.json | 6 +++--- src/IDListLayer.cpp | 25 +++++++------------------ src/IDListLayer.hpp | 2 +- 6 files changed, 18 insertions(+), 22 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..07764a7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 228ace9..b7d0516 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,9 @@ jobs: - name: Windows os: windows-latest + - name: macOS + os: macos-latest + - name: Android32 os: ubuntu-latest target: Android32 diff --git a/changelog.md b/changelog.md index 29cbc3a..c600fa6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # Integrated Demonlist Changelog +## v1.4.2 (2024-03-08) +- Fixed the randomize button on the demonlist page + ## v1.4.1 (2024-03-06) - Added the demonlist to the list search menu diff --git a/mod.json b/mod.json index 9e2f429..cd70b21 100644 --- a/mod.json +++ b/mod.json @@ -1,11 +1,11 @@ { - "geode": "2.0.0-beta.20", + "geode": "2.0.0-beta.21", "gd": { "android": "2.205", "win": "2.204", "mac": "2.200" }, - "version": "v1.4.1", + "version": "v1.4.2", "id": "hiimjustin000.integrated_demonlist", "name": "Integrated Demonlist", "developer": "hiimjustin000", @@ -33,7 +33,7 @@ "dependencies": [ { "id": "geode.node-ids", - "version": ">=v1.6.1", + "version": ">=v1.7.1", "importance": "required" } ] diff --git a/src/IDListLayer.cpp b/src/IDListLayer.cpp index b6dd266..06c5957 100644 --- a/src/IDListLayer.cpp +++ b/src/IDListLayer.cpp @@ -1,4 +1,5 @@ #include "IDListLayer.hpp" +#include #include template @@ -19,21 +20,6 @@ std::string join(std::vector const& vec, std::string const& delim) { return ret; } -std::vector split(std::string const& str, std::string const& delim) { - size_t pos_start = 0, pos_end, delim_len = delim.length(); - std::string token; - std::vector res; - - while ((pos_end = str.find(delim, pos_start)) != std::string::npos) { - token = str.substr(pos_start, pos_end - pos_start); - pos_start = pos_end + delim_len; - res.push_back(token); - } - - res.push_back(str.substr(pos_start)); - return res; -} - std::string toLowerCase(std::string str) { auto strCopy = std::string(str); std::transform(strCopy.begin(), strCopy.end(), strCopy.begin(), ::tolower); @@ -76,7 +62,7 @@ bool IDListLayer::init() { auto winSize = CCDirector::sharedDirector()->getWinSize(); auto bg = CCSprite::create("GJ_gradientBG.png"); - auto bgSize = bg->getTextureRect().size; + CCSize bgSize = bg->getTextureRect().size; bg->setAnchorPoint({ 0.0f, 0.0f }); bg->setScaleX((winSize.width + 10.0f) / bgSize.width); @@ -153,7 +139,6 @@ bool IDListLayer::init() { m_refreshMenu->setPosition(CCDirector::sharedDirector()->getScreenRight() - y, y); m_refreshMenu->setZOrder(2); auto refreshBtn = CCMenuItemSpriteExtra::create(refreshBtnSpr, this, menu_selector(IDListLayer::onRefresh)); - refreshBtn->setID("demonlist-button"_spr); m_refreshMenu->addChild(refreshBtn); this->addChild(m_refreshMenu); @@ -371,7 +356,11 @@ void IDListLayer::onPage(CCObject*) { } void IDListLayer::onRandom(CCObject*) { - m_page = rand() % (paddedSize(m_fullSearchResults.size(), 10) / 10); + std::random_device os_seed; + const unsigned int seed = os_seed(); + std::mt19937 generator(seed); + std::uniform_int_distribution distribute(0, paddedSize(m_fullSearchResults.size(), 10) / 10 - 1); + m_page = distribute(generator); populateList(m_query); } diff --git a/src/IDListLayer.hpp b/src/IDListLayer.hpp index 1229839..77baf09 100644 --- a/src/IDListLayer.hpp +++ b/src/IDListLayer.hpp @@ -11,7 +11,7 @@ class IDListLayer : public CCLayer, SetIDPopupDelegate, LevelManagerDelegate { static void loadAREDL() { loadAREDL([]() {}); } - static void loadAREDL(utils::MiniFunction callback); + static void loadAREDL(MiniFunction callback); void onExit(CCObject*); void onSearch(CCObject*);