diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-03-31 16:54:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-01 03:56:16 +0300 |
commit | 761682b6254a3d43e65ff45e07683c61afa6f1e4 (patch) | |
tree | 2ee462840f3aadb1e96bfa5c6784ec2cc0d2861a /src/resources/wallpaper.cpp | |
parent | a39f63cdfa5ce15b22f294a8bb1db3a036ce462d (diff) | |
download | manaverse-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.gz manaverse-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.bz2 manaverse-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.xz manaverse-761682b6254a3d43e65ff45e07683c61afa6f1e4.zip |
Last part of fixes.
Diffstat (limited to 'src/resources/wallpaper.cpp')
-rw-r--r-- | src/resources/wallpaper.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
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<unsigned>(time(nullptr))); - return wallPaperVector[int(static_cast<double>( - 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<unsigned>(time(nullptr))); + return wallPaperVector[int(static_cast<double>( + wallPaperVector.size()) * rand() / (RAND_MAX + 1.0))]; } // Return the backup file if everything else failed... |