summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorSilarn <jrim@rimpo.org>2019-01-29 01:35:13 -0600
committerSilarn <jrim@rimpo.org>2019-02-18 21:28:26 -0600
commita305ea2270c02172973f365986f194652ad344ec (patch)
tree8b38ca0c15f84c74dd218286520b72aa6ff250ec /src/mainwindow.cpp
parent370e010a1adebf68efe5062c5d3a2ed8e048b654 (diff)
Translate nexus game name to short name to fix fetching updates
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2f39bf7a..02720d44 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -5455,14 +5455,14 @@ void MainWindow::nxmUpdatesAvailable(QString gameName, int modID, QVariant userD
bool foundUpdate = false;
m_ModsToUpdate--;
bool sameNexus = false;
+ QString gameNameReal;
for (IPluginGame *game : m_PluginContainer.plugins<IPluginGame>()) {
- if (game->gameShortName() == gameName) {
- if (game->nexusGameID() == m_OrganizerCore.managedGame()->nexusGameID())
- sameNexus = true;
+ if (game->gameNexusName() == gameName) {
+ gameNameReal = game->gameShortName();
break;
}
}
- std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameName, modID);
+ std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameNameReal, modID);
// Not clear to me what this is accomplishing?
//if (sameNexus) {
// std::vector<ModInfo::Ptr> mainInfo = ModInfo::getByModID(m_OrganizerCore.managedGame()->gameShortName(), modID);
@@ -5553,7 +5553,14 @@ void MainWindow::nxmUpdatesAvailable(QString gameName, int modID, QVariant userD
void MainWindow::nxmDescriptionAvailable(QString gameName, int modID, QVariant userData, QVariant resultData, int requestID)
{
QVariantMap result = resultData.toMap();
- std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameName, modID);
+ QString gameNameReal;
+ for (IPluginGame *game : m_PluginContainer.plugins<IPluginGame>()) {
+ if (game->gameNexusName() == gameName) {
+ gameNameReal = game->gameShortName();
+ break;
+ }
+ }
+ std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameNameReal, modID);
for (auto mod : modsList) {
mod->setNexusDescription(result["description"].toString());
mod->setNewestVersion(result["version"].toString());
@@ -5615,7 +5622,14 @@ void MainWindow::nxmRequestFailed(QString gameName, int modID, int, QVariant, in
statusBar()->hide();
}
if (error == QNetworkReply::ContentAccessDenied || error == QNetworkReply::ContentNotFoundError) {
- std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameName, modID);
+ QString gameNameReal;
+ for (IPluginGame *game : m_PluginContainer.plugins<IPluginGame>()) {
+ if (game->gameNexusName() == gameName) {
+ gameNameReal = game->gameShortName();
+ break;
+ }
+ }
+ std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameNameReal, modID);
for (auto mod : modsList) {
mod->setNexusID(-1);
}