projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3c0d675
)
moved updating game panel values after solving game to separate function
author
Holger Schemel
<info@artsoft.org>
Mon, 14 Jun 2021 16:01:57 +0000
(18:01 +0200)
committer
Holger Schemel
<info@artsoft.org>
Mon, 14 Jun 2021 16:01:57 +0000
(18:01 +0200)
src/game.c
patch
|
blob
|
history
diff --git
a/src/game.c
b/src/game.c
index 4e1c699d28a5768cc56a2a6c80586f85a9f85403..1533d9555a231de40cd1a42c9368584604c8b233 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-4717,6
+4717,19
@@
static void LevelSolved_SetFinalGameValues(void)
game.LevelSolved_CountingHealth = game.health_final;
}
game.LevelSolved_CountingHealth = game.health_final;
}
+static void LevelSolved_DisplayFinalGameValues(int time, int score, int health)
+{
+ game.LevelSolved_CountingTime = time;
+ game.LevelSolved_CountingScore = score;
+ game.LevelSolved_CountingHealth = health;
+
+ game_panel_controls[GAME_PANEL_TIME].value = time;
+ game_panel_controls[GAME_PANEL_SCORE].value = score;
+ game_panel_controls[GAME_PANEL_HEALTH].value = health;
+
+ DisplayGameControlValues();
+}
+
static void LevelSolved(void)
{
if (level.game_engine_type == GAME_ENGINE_TYPE_RND &&
static void LevelSolved(void)
{
if (level.game_engine_type == GAME_ENGINE_TYPE_RND &&
@@
-4817,13
+4830,7
@@
void GameWon(void)
time = time_final;
score = score_final;
time = time_final;
score = score_final;
- game.LevelSolved_CountingTime = time;
- game.LevelSolved_CountingScore = score;
-
- game_panel_controls[GAME_PANEL_TIME].value = time;
- game_panel_controls[GAME_PANEL_SCORE].value = score;
-
- DisplayGameControlValues();
+ LevelSolved_DisplayFinalGameValues(time, score, health);
}
if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
}
if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
@@
-4900,13
+4907,7
@@
void GameWon(void)
if (time == time_final)
score = score_final;
if (time == time_final)
score = score_final;
- game.LevelSolved_CountingTime = time;
- game.LevelSolved_CountingScore = score;
-
- game_panel_controls[GAME_PANEL_TIME].value = time;
- game_panel_controls[GAME_PANEL_SCORE].value = score;
-
- DisplayGameControlValues();
+ LevelSolved_DisplayFinalGameValues(time, score, health);
if (time == time_final)
StopSound(SND_GAME_LEVELTIME_BONUS);
if (time == time_final)
StopSound(SND_GAME_LEVELTIME_BONUS);
@@
-4932,13
+4933,7
@@
void GameWon(void)
health += health_count_dir;
score += time_score;
health += health_count_dir;
score += time_score;
- game.LevelSolved_CountingHealth = health;
- game.LevelSolved_CountingScore = score;
-
- game_panel_controls[GAME_PANEL_HEALTH].value = health;
- game_panel_controls[GAME_PANEL_SCORE].value = score;
-
- DisplayGameControlValues();
+ LevelSolved_DisplayFinalGameValues(time, score, health);
if (health == health_final)
StopSound(SND_GAME_LEVELTIME_BONUS);
if (health == health_final)
StopSound(SND_GAME_LEVELTIME_BONUS);