void ChalkyManager::resetGameState() { blueChalkyPosition = 0; yellowChalkyPosition = 0; redChalkyPosition = 0; indexToHideHSMode = 0; lastScore = 0; loadLives(); }
bool SQLitePersister::loadCampaign (Campaign* campaign) { _activeCampaign = campaign->getId(); const uint8_t lives = loadLives(campaign->getId()); if (lives == 0) { Log::error(LOG_CAMPAIGN, "no live entry for %s", campaign->getId().c_str()); return false; } campaign->resetMaps(); campaign->setLives(lives); SQLiteStatement stmt; prepare(stmt, "SELECT * FROM " TABLE_GAMEMAPS " WHERE campaignid = ?;"); if (!stmt) return false; stmt.bindText(1, campaign->getId()); for (;;) { const int s = stmt.step(); if (s == SQLITE_ROW) { const std::string mapid = stmt.getText(1); CampaignMap* map = campaign->getMapById(mapid); if (map) { loadCampaignMapParameters(map, stmt); } } else if (s == SQLITE_DONE) { break; } else { Log::error(LOG_CAMPAIGN, "SQL step error in loadCampaign"); return false; } } return campaign->getLives() > 0; }