fixed highscores

This commit is contained in:
2025-12-21 21:17:58 +01:00
parent 494f906435
commit fb82ac06d0
6 changed files with 281 additions and 10 deletions

View File

@ -899,7 +899,7 @@ void TetrisApp::Impl::runLoop()
int rightScore = coopGame->score(CoopGame::PlayerSide::Right);
int combinedScore = leftScore + rightScore;
ensureScoresLoaded();
scores.submit(combinedScore, coopGame->lines(), coopGame->level(), coopGame->elapsed(), combined);
scores.submit(combinedScore, coopGame->lines(), coopGame->level(), coopGame->elapsed(), combined, "cooperate");
Settings::instance().setPlayerName(playerName);
isNewHighScore = false;
SDL_StopTextInput(window);
@ -911,7 +911,8 @@ void TetrisApp::Impl::runLoop()
} else if (e.key.scancode == SDL_SCANCODE_RETURN || e.key.scancode == SDL_SCANCODE_KP_ENTER) {
if (playerName.empty()) playerName = "PLAYER";
ensureScoresLoaded();
scores.submit(game->score(), game->lines(), game->level(), game->elapsed(), playerName);
std::string gt = (game->getMode() == GameMode::Challenge) ? "challenge" : "classic";
scores.submit(game->score(), game->lines(), game->level(), game->elapsed(), playerName, gt);
Settings::instance().setPlayerName(playerName);
isNewHighScore = false;
SDL_StopTextInput(window);
@ -1302,7 +1303,7 @@ void TetrisApp::Impl::runLoop()
} else {
isNewHighScore = false;
ensureScoresLoaded();
scores.submit(combinedScore, coopGame->lines(), coopGame->level(), coopGame->elapsed());
scores.submit(combinedScore, coopGame->lines(), coopGame->level(), coopGame->elapsed(), "P1 & P2", "cooperate");
}
state = AppState::GameOver;
stateMgr->setState(state);
@ -1328,7 +1329,10 @@ void TetrisApp::Impl::runLoop()
} else {
isNewHighScore = false;
ensureScoresLoaded();
scores.submit(game->score(), game->lines(), game->level(), game->elapsed());
{
std::string gt = (game->getMode() == GameMode::Challenge) ? "challenge" : "classic";
scores.submit(game->score(), game->lines(), game->level(), game->elapsed(), "PLAYER", gt);
}
}
state = AppState::GameOver;
stateMgr->setState(state);