From ca7a149874e99a8f401cb30c430f58a48be4c642 Mon Sep 17 00:00:00 2001 From: Al <26797547+Al12rs@users.noreply.github.com> Date: Mon, 4 May 2026 04:47:20 +0200 Subject: Improve mod update check accuracy (#2385) * Index API response into lookup maps * extract new findLatestActiveSuccessor method from update check function * extract method to check if a file is active * use new isActiveFileStatus in modInfoRegular * fix bug when merging during mod install * remember ordering of installed nexus file ids * refactor update check logic to prioritize Nexus file IDs over filenames * refactor nxmUpdatesAvailable to simplify update checking logic * refactor update check logic to find Nexus file IDs by filename and streamline successor retrieval * refactor update checking to streamline version resolution and improve successor retrieval --- src/modinforegular.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/modinforegular.h') diff --git a/src/modinforegular.h b/src/modinforegular.h index 062f3dd8..6f5daba8 100644 --- a/src/modinforegular.h +++ b/src/modinforegular.h @@ -2,6 +2,7 @@ #define MODINFOREGULAR_H #include +#include #include "modinfowithconflictinfo.h" #include "nexusinterface.h" @@ -445,7 +446,21 @@ public: virtual bool validated() const override { return m_Validated; } virtual std::set> installedFiles() const override { - return m_InstalledFileIDs; + return {m_InstalledFileIDs.begin(), m_InstalledFileIDs.end()}; + } + + /** + * @brief Nexus file id of this mod's install. When multiple installs have + * been merged, returns the most recent. + * + * @return The file id, or nullopt if no nexusId has been recorded. + */ + std::optional nexusFileId() const + { + if (m_InstalledFileIDs.empty()) { + return std::nullopt; + } + return m_InstalledFileIDs.back().second; } public: // Plugin operations: @@ -505,7 +520,8 @@ private: QColor m_Color; int m_NexusID; - std::set> m_InstalledFileIDs; + // Ordered by install time, oldest first; back is the most recent install. + std::vector> m_InstalledFileIDs; // List of plugin settings: std::map> m_PluginSettings; -- cgit v1.3.1