From a305ea2270c02172973f365986f194652ad344ec Mon Sep 17 00:00:00 2001 From: Silarn Date: Tue, 29 Jan 2019 01:35:13 -0600 Subject: Translate nexus game name to short name to fix fetching updates --- src/mainwindow.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/mainwindow.cpp') 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()) { - if (game->gameShortName() == gameName) { - if (game->nexusGameID() == m_OrganizerCore.managedGame()->nexusGameID()) - sameNexus = true; + if (game->gameNexusName() == gameName) { + gameNameReal = game->gameShortName(); break; } } - std::vector modsList = ModInfo::getByModID(gameName, modID); + std::vector modsList = ModInfo::getByModID(gameNameReal, modID); // Not clear to me what this is accomplishing? //if (sameNexus) { // std::vector 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 modsList = ModInfo::getByModID(gameName, modID); + QString gameNameReal; + for (IPluginGame *game : m_PluginContainer.plugins()) { + if (game->gameNexusName() == gameName) { + gameNameReal = game->gameShortName(); + break; + } + } + std::vector 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 modsList = ModInfo::getByModID(gameName, modID); + QString gameNameReal; + for (IPluginGame *game : m_PluginContainer.plugins()) { + if (game->gameNexusName() == gameName) { + gameNameReal = game->gameShortName(); + break; + } + } + std::vector modsList = ModInfo::getByModID(gameNameReal, modID); for (auto mod : modsList) { mod->setNexusID(-1); } -- cgit v1.3.1