Fixed bug in pause code. It wasn't pausing everything.
This commit is contained in:
@@ -126,6 +126,8 @@ void main()
|
|||||||
speak_with_history("Paused. Press backspace to resume.", true);
|
speak_with_history("Paused. Press backspace to resume.", true);
|
||||||
} else {
|
} else {
|
||||||
p.resume_all();
|
p.resume_all();
|
||||||
|
// Restart all timers to prevent time from accumulating while paused
|
||||||
|
restart_all_timers();
|
||||||
speak_with_history("Resumed.", true);
|
speak_with_history("Resumed.", true);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -53,3 +53,17 @@ bool searching = false;
|
|||||||
|
|
||||||
// Pause state
|
// Pause state
|
||||||
bool game_paused = false;
|
bool game_paused = false;
|
||||||
|
|
||||||
|
// Restart all game timers when resuming from pause
|
||||||
|
// Prevents time from accumulating while paused
|
||||||
|
void restart_all_timers() {
|
||||||
|
// Player timers
|
||||||
|
fire_damage_timer.restart();
|
||||||
|
healing_timer.restart();
|
||||||
|
sling_charge_timer.restart();
|
||||||
|
|
||||||
|
// Fire fuel timers
|
||||||
|
for (uint i = 0; i < world_fires.length(); i++) {
|
||||||
|
world_fires[i].fuel_timer.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user