Skip to content

Commit f1d465b

Browse files
committed
not saving score when is 0.
1 parent 617d4aa commit f1d465b

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/main.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ std::vector<Kana> loadAssets()
5050
"ma", "mi", "mu", "me", "mo",
5151
"ya", "yu", "yo",
5252
"ra", "ri", "ru", "re", "ro",
53-
"wa", "wo", "n"
54-
};
53+
"wa", "wo", "n"};
5554

5655
for (std::string &kanaName : kanaNames)
5756
{
@@ -362,6 +361,13 @@ int main()
362361

363362
std::string playerName = loadPlayerName();
364363

364+
bool isHighScoreScreen = false;
365+
366+
if (playerName.compare("aaa") == 0)
367+
{
368+
isHighScoreScreen = true;
369+
}
370+
365371
std::vector<std::string> highScores = loadHighScores();
366372

367373
int attempts = 0;
@@ -384,7 +390,6 @@ int main()
384390

385391
bool isLearningMode = true;
386392
bool isHiraganaMode = true;
387-
bool isHighScoreScreen = false;
388393

389394
int previousKanaIndex = 0;
390395
int actualKanaIndex = GetRandomValue(hiraganasInitialIndex, totalHiraganas);
@@ -405,7 +410,7 @@ int main()
405410
int nextFrameDataOffset = 0; // Current byte offset to next frame in image.data
406411
int currentAnimationFrame = 0; // Current animation frame to load and draw
407412
int frameDelay = 8; // Frame delay to switch between animation frames
408-
int animationFrameCounter = 0; // General frames counter
413+
int animationFrameCounter = 0; // General frames counter
409414

410415
while (!WindowShouldClose())
411416
{
@@ -507,7 +512,11 @@ int main()
507512
attempts = 0;
508513
showScoreTimer = 0;
509514

510-
highScores = saveActualHighScores(highScores, score, playerName);
515+
if (score > 0)
516+
{
517+
highScores = saveActualHighScores(highScores, score, playerName);
518+
}
519+
511520
updateHighScore(score);
512521
}
513522

@@ -555,7 +564,12 @@ int main()
555564
isLearningMode = true;
556565
attempts = 0;
557566
showScoreTimer = 0;
558-
highScores = saveActualHighScores(highScores, score, playerName);
567+
568+
if (score > 0)
569+
{
570+
highScores = saveActualHighScores(highScores, score, playerName);
571+
}
572+
559573
updateHighScore(score);
560574
}
561575
}

0 commit comments

Comments
 (0)