supabase integration instead firebase
This commit is contained in:
@ -813,11 +813,16 @@ void MenuState::render(SDL_Renderer* renderer, float logicalScale, SDL_Rect logi
|
||||
}
|
||||
static const std::vector<ScoreEntry> EMPTY_SCORES;
|
||||
const auto& hs = ctx.scores ? ctx.scores->all() : EMPTY_SCORES;
|
||||
// Filter highscores to show only classic gameplay entries on the main menu
|
||||
// Choose which game_type to show based on current menu selection
|
||||
std::string wantedType = "classic";
|
||||
if (selectedButton == 0) wantedType = "classic"; // Play / Endless
|
||||
else if (selectedButton == 1) wantedType = "cooperate"; // Coop
|
||||
else if (selectedButton == 2) wantedType = "challenge"; // Challenge
|
||||
// Filter highscores to the desired game type
|
||||
std::vector<ScoreEntry> filtered;
|
||||
filtered.reserve(hs.size());
|
||||
for (const auto &e : hs) {
|
||||
if (e.gameType == "classic") filtered.push_back(e);
|
||||
if (e.gameType == wantedType) filtered.push_back(e);
|
||||
}
|
||||
size_t maxDisplay = std::min(filtered.size(), size_t(10)); // display only top 10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user