Correct column order

This commit is contained in:
David Markowitz 2023-05-09 22:21:41 -07:00
parent 3448426caf
commit 4dba8d9225
5 changed files with 7 additions and 6 deletions

View File

@ -182,7 +182,7 @@ std::string Leaderboard::GetInsertFormat(Leaderboard::Type leaderboardType) {
std::string columns;
switch (leaderboardType) {
case Type::ShootingGallery:
columns = "hitPercentage=%f, score=%i, streak=%i";
columns = "score=%i, hitPercentage=%f, streak=%i";
break;
case Type::Racing:
columns = "bestLapTime=%i, bestTime=%i, numWins=numWins + %i";
@ -539,10 +539,10 @@ void LeaderboardManager::SaveScore(const LWOOBJID& playerID, GameID gameID, Lead
va_end(argsCopy);
}
void LeaderboardManager::SendLeaderboard(uint32_t gameID, Leaderboard::InfoType infoType, bool weekly, LWOOBJID playerID, uint32_t resultStart, uint32_t resultEnd) {
void LeaderboardManager::SendLeaderboard(uint32_t gameID, Leaderboard::InfoType infoType, bool weekly, LWOOBJID playerID, LWOOBJID targetID, uint32_t resultStart, uint32_t resultEnd) {
Leaderboard leaderboard(gameID, infoType, weekly, playerID, GetLeaderboardType(gameID));
leaderboard.SetupLeaderboard(resultStart, resultEnd);
leaderboard.Send(playerID);
leaderboard.Send(targetID);
}
Leaderboard::Type LeaderboardManager::GetLeaderboardType(const GameID gameID) {

View File

@ -100,7 +100,7 @@ private:
class LeaderboardManager : public Singleton<LeaderboardManager> {
typedef std::map<GameID, Leaderboard::Type> LeaderboardCache;
public:
void SendLeaderboard(GameID gameID, Leaderboard::InfoType infoType, bool weekly, LWOOBJID playerID, uint32_t resultStart = 0, uint32_t resultEnd = 10);
void SendLeaderboard(GameID gameID, Leaderboard::InfoType infoType, bool weekly, LWOOBJID playerID, LWOOBJID targetID, uint32_t resultStart = 0, uint32_t resultEnd = 10);
/**
* @brief Public facing Score saving method. This method is simply a wrapper to ensure va_end is called properly.

View File

@ -1661,7 +1661,7 @@ void GameMessages::HandleRequestActivitySummaryLeaderboardData(RakNet::BitStream
bool weekly = inStream->ReadBit();
LeaderboardManager::Instance().SendLeaderboard(gameID, queryType, weekly, entity->GetObjectID(), resultsStart, resultsEnd);
LeaderboardManager::Instance().SendLeaderboard(gameID, queryType, weekly, entity->GetObjectID(), entity->GetObjectID(), resultsStart, resultsEnd);
}
void GameMessages::HandleActivityStateChangeRequest(RakNet::BitStream* inStream, Entity* entity) {

View File

@ -125,7 +125,7 @@ void ActivityManager::GetLeaderboardData(Entity* self, const LWOOBJID playerID,
// Save the new score to the leaderboard and show the leaderboard to the player
auto leaderboardType = LeaderboardManager::GetLeaderboardType(gameID);
Game::logger->Log("ActivityManager", "gameID %i", gameID, activityID);
LeaderboardManager::Instance().SendLeaderboard(activityID, Leaderboard::InfoType::MyStanding, false, playerID, 0, numResults);
LeaderboardManager::Instance().SendLeaderboard(activityID, Leaderboard::InfoType::MyStanding, false, playerID, self->GetObjectID(), 0, numResults);
}
void ActivityManager::ActivityTimerStart(Entity* self, const std::string& timerName, const float_t updateInterval,

View File

@ -565,6 +565,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar<uint32_t>(TotalScoreVariable));
StopActivity(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), self->GetVar<uint32_t>(MaxStreakVariable), percentage);
SaveScore(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), percentage, self->GetVar<uint32_t>(MaxStreakVariable));
self->SetNetworkVar<bool>(AudioFinalWaveDoneVariable, true);
// Give the player the model rewards they earned