Merge pull request #114 from QuasarApp/task_110

premium bonus
This commit is contained in:
Andrei Yankovich 2021-07-16 11:57:06 +03:00 committed by GitHub
commit 84cfae8f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -5,6 +5,7 @@
* of this license document, but changing it is not allowed.
*/
#include "gamestate.h"
#include "gamestate.h"
int GameState::getMaxValueOfLoadedSaves() {
@ -28,6 +29,11 @@ void GameState::unlockNextLvl() {
_lvl = static_cast<short>(maxValueOfLoadedSave);
}
void GameState::unlockLvlTo(int toLevel) {
maxValueOfLoadedSave = toLevel;
_lvl = static_cast<short>(maxValueOfLoadedSave);
}
bool GameState::fSavedGame() const {
for (const auto &tower: qAsConst(save) ) {
if (tower.size()) {

View File

@ -33,6 +33,7 @@ public:
Q_INVOKABLE void setStep(int value);
Q_INVOKABLE void unlockNextLvl();
Q_INVOKABLE void unlockLvlTo(int toLevel);
friend bool operator == (const GameState& left, const GameState& right);

View File

@ -317,6 +317,16 @@ void HanoiTowers::handleAcceptUserData(QSharedPointer<LocalUser> data) {
loadOldSaves();
#ifdef Q_OS_ANDROID
#ifndef HANOI_ADMOD
if (_profile.gameState()->lvl() < 15) {
_profile.gameState()->unlockLvlTo(15);
}
#endif
#endif
emit profileChanged();
}