void SQLitePersister::loadCampaignMapParameters(CampaignMap* map, SQLiteStatement& stmt)
{
	const int locked = stmt.getInt(2);
	const int time = stmt.getInt(3);
	const int finishPoints = stmt.getInt(4);
	const int stars = stmt.getInt(5);
	map->setTime(time);
	map->setFinishPoints(finishPoints);
	map->setStars(stars);
	if (locked == 0)
		map->unlock();
}
uint8_t SQLitePersister::loadLives (const std::string& campaignId)
{
	SQLiteStatement stmt;
	prepare(stmt, "SELECT lives FROM " TABLE_LIVES " WHERE campaignid = ?;");
	if (!stmt) {
		Log::info(LOG_CAMPAIGN, "no lives entry for %s", campaignId.c_str());
		return 0;
	}

	stmt.bindText(1, campaignId);

	const int s = stmt.step();
	if (s == SQLITE_ROW) {
		const int lives = stmt.getInt(0);
		Log::info(LOG_CAMPAIGN, "got %i lives for campaign %s", lives, campaignId.c_str());
		return lives;
	} else if (s != SQLITE_DONE) {
		Log::error(LOG_CAMPAIGN, "error loading lives");
	}

	return 0;
}
uint8_t SQLitePersister::loadLives (const std::string& campaignId)
{
	SQLiteStatement stmt;
	prepare(stmt, "SELECT lives FROM " TABLE_LIVES " WHERE campaignid = ?;");
	if (!stmt) {
		info(LOG_STORAGE, "no lives entry for " + campaignId);
		return 0;
	}

	stmt.bindText(1, campaignId);

	const int s = stmt.step();
	if (s == SQLITE_ROW) {
		const int lives = stmt.getInt(0);
		info(LOG_STORAGE, "got " + string::toString(lives) + " lives for campaign " + campaignId);
		return lives;
	} else if (s != SQLITE_DONE) {
		error(LOG_STORAGE, "error loading lives");
	}

	return 0;
}