diff options
| author | Al <26797547+Al12rs@users.noreply.github.com> | 2026-05-04 04:47:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-03 21:47:20 -0500 |
| commit | ca7a149874e99a8f401cb30c430f58a48be4c642 (patch) | |
| tree | 9764a43289eab32bfb838aa91234ddf87fae4eb0 /src/modinforegular.h | |
| parent | ef7499aade74a148416b5fde7e8c03a75ea381c3 (diff) | |
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
Diffstat (limited to 'src/modinforegular.h')
| -rw-r--r-- | src/modinforegular.h | 20 |
1 files changed, 18 insertions, 2 deletions
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 <limits> +#include <optional> #include "modinfowithconflictinfo.h" #include "nexusinterface.h" @@ -445,7 +446,21 @@ public: virtual bool validated() const override { return m_Validated; } virtual std::set<std::pair<int, int>> 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<int> 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<std::pair<int, int>> m_InstalledFileIDs; + // Ordered by install time, oldest first; back is the most recent install. + std::vector<std::pair<int, int>> m_InstalledFileIDs; // List of plugin settings: std::map<QString, std::map<QString, QVariant>> m_PluginSettings; |
