diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-06-07 15:23:52 +0300 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-06-07 15:23:52 +0300 |
commit | 0b156f1d26abd336cdfff540a753741359dfb3ef (patch) | |
tree | 47122f2fdec07fbf72961980ef5e6dc3ba40ab50 /src/core/Stats.cpp | |
parent | c50a61d52aea452c4950062a2363576c25f662b8 (diff) |
some stats tweaks; saves dead again
Diffstat (limited to 'src/core/Stats.cpp')
-rw-r--r-- | src/core/Stats.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp index 91f583bd..bc69105b 100644 --- a/src/core/Stats.cpp +++ b/src/core/Stats.cpp @@ -60,6 +60,7 @@ int32 CStats::mmRain; int32 CStats::CarsCrushed; int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES]; int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES]; +int32 CStats::BestPositions[CStats::TOTAL_BEST_POSITIONS]; int32 CStats::PropertyDestroyed; int32 CStats::Sprayings; @@ -119,6 +120,8 @@ void CStats::Init() FastestTimes[i] = 0; for (int i = 0; i < TOTAL_HIGHEST_SCORES; i++) HighestScores[i] = 0; + for (int i = 0; i < TOTAL_BEST_POSITIONS; i++) + BestPositions[i] = INT_MAX; for (int i = 0; i < NUM_PEDTYPES; i++) PedsKilledOfThisType[i] = 0; IndustrialPassed = 0; @@ -146,6 +149,12 @@ void CStats::RegisterHighestScore(int32 index, int32 score) HighestScores[index] = Max(HighestScores[index], score); } +void CStats::RegisterBestPosition(int32 index, int32 position) +{ + assert(index >= 0 && index < TOTAL_BEST_POSITIONS); + BestPositions[index] = Min(BestPositions[index], position); +} + void CStats::RegisterElBurroTime(int32 time) { ElBurroTime = (ElBurroTime && ElBurroTime < time) ? ElBurroTime : time; @@ -377,6 +386,7 @@ void CStats::SaveStats(uint8 *buf, uint32 *size) CopyToBuf(buf, TotalNumberMissions); CopyToBuf(buf, FastestTimes); CopyToBuf(buf, HighestScores); + CopyToBuf(buf, BestPositions); CopyToBuf(buf, KillsSinceLastCheckpoint); CopyToBuf(buf, TotalLegitimateKills); CopyToBuf(buf, LastMissionPassedName); @@ -440,6 +450,7 @@ void CStats::LoadStats(uint8 *buf, uint32 size) CopyFromBuf(buf, TotalNumberMissions); CopyFromBuf(buf, FastestTimes); CopyFromBuf(buf, HighestScores); + CopyFromBuf(buf, BestPositions); CopyFromBuf(buf, KillsSinceLastCheckpoint); CopyFromBuf(buf, TotalLegitimateKills); CopyFromBuf(buf, LastMissionPassedName); |