From 761682b6254a3d43e65ff45e07683c61afa6f1e4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 31 Mar 2012 16:54:22 +0300 Subject: Last part of fixes. --- src/resources/wallpaper.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/resources/wallpaper.cpp') diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index d4537e963..7b89bed6e 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -149,21 +149,14 @@ std::string Wallpaper::getWallpaper(int width, int height) wallPaperVector.push_back(wp.filename); } + // If we've got more than one occurence of a valid wallpaper... if (!wallPaperVector.empty()) { - // If we've got more than one occurence of a valid wallpaper... - if (!wallPaperVector.empty()) - { - // Return randomly a wallpaper between vector[0] and - // vector[vector.size() - 1] - srand(static_cast(time(nullptr))); - return wallPaperVector[int(static_cast( - wallPaperVector.size()) * rand() / (RAND_MAX + 1.0))]; - } - else // If there at least one, we return it - { - return wallPaperVector[0]; - } + // Return randomly a wallpaper between vector[0] and + // vector[vector.size() - 1] + srand(static_cast(time(nullptr))); + return wallPaperVector[int(static_cast( + wallPaperVector.size()) * rand() / (RAND_MAX + 1.0))]; } // Return the backup file if everything else failed... -- cgit v1.2.3-60-g2f50