Fix bug in update check and fix cover download condition

This commit is contained in:
Sude 2013-03-16 04:56:32 +02:00
parent 25055a03c8
commit 2e2e87a76b

View File

@ -162,18 +162,14 @@ void Downloader::updateCheck()
config.sGameRegex = ".*"; // Always check all games config.sGameRegex = ".*"; // Always check all games
if (config.bList || config.bListDetails || config.bDownload) if (config.bList || config.bListDetails || config.bDownload)
{ {
if (config.bList)
config.bListDetails = true; // Always list details
this->getGameList(); this->getGameList();
if (config.bDownload) if (config.bDownload)
{
this->download(); this->download();
}
else else
{
config.bListDetails = true; // Always list details
this->listGames(); this->listGames();
} }
}
} }
} }
@ -223,6 +219,7 @@ void Downloader::getGameList()
int Downloader::getGameDetails() int Downloader::getGameDetails()
{ {
gameDetails game; gameDetails game;
int updated = 0;
for (unsigned int i = 0; i < gameNames.size(); ++i) for (unsigned int i = 0; i < gameNames.size(); ++i)
{ {
std::cout << "Getting game info " << i+1 << " / " << gameNames.size() << "\r" << std::flush; std::cout << "Getting game info " << i+1 << " / " << gameNames.size() << "\r" << std::flush;
@ -238,10 +235,11 @@ int Downloader::getGameDetails()
if (game.installers[j].updated) if (game.installers[j].updated)
{ {
games.push_back(game); games.push_back(game);
updated++;
break; // add the game only once break; // add the game only once
} }
} }
if (i >= static_cast<unsigned int>(gogAPI->user.notifications_games)) if (updated >= gogAPI->user.notifications_games)
{ // Gone through all updated games. No need to go through the rest. { // Gone through all updated games. No need to go through the rest.
std::cout << std::endl << "Got info for all updated games. Moving on..." << std::endl; std::cout << std::endl << "Got info for all updated games. Moving on..." << std::endl;
break; break;
@ -394,7 +392,7 @@ void Downloader::download()
for (unsigned int i = 0; i < games.size(); ++i) for (unsigned int i = 0; i < games.size(); ++i)
{ {
// Download covers // Download covers
if (!config.bNoCover || !config.bUpdateCheck) if (!config.bNoCover && !config.bUpdateCheck)
{ {
// Doesn't work as intended unless we use "games[i].gamename" as base directory for installers and extras // Doesn't work as intended unless we use "games[i].gamename" as base directory for installers and extras
// std::string directory = config.sDirectory + games[i].gamename + "/"; // std::string directory = config.sDirectory + games[i].gamename + "/";