Turn statistics back on for a new game and fix low winning scores

Winning turned statistics off and nothing turned them back on, while
the Settings checkbox still showed them as on. Resetting points now
turns them back on if the win turned them off, and the checkbox shows
the current state when Settings is opened.

A winning score of 1 could never be won and with 2 the first point was
not announced as match point, because the first-point check ran first.
The winning score also could not be kept from going below 1.
This commit is contained in:
Sansan committed 2026-10-05 21:12:17 +02:00
1 parent d856e03c32
commit 056ead47be
6 files changed
+111 -6

No files matched your search

+11 -1
View File
@@ -140,6 +140,9 @@ var songs: Array= []
var soundtracks: Array = []
var current_player: Node
## True while statistics are off because a player won, until points are reset.
var stats_paused_by_win: bool = false
## Seconds to wait before retrying a song download step that failed.
var song_fetch_retry_seconds: float = 5.0
@@ -368,6 +371,10 @@ func reset_points() -> void:
for player_objects: PlayerObject in Settings.player_array:
player_objects.reset_points()
load_players()
# A new game starts, so turn statistics back on if winning turned them off
if stats_paused_by_win:
Settings.add_to_stats = true
stats_paused_by_win = false
func show_about() -> void:
print("show_about")
@@ -487,7 +494,10 @@ func _on_player_won(player_object: PlayerObject) -> void:
print("_on_player_won")
winner_window.show_winner(player_object)
music_player_container.play_song(preload("res://sounds/winning.mp3"))
Settings.add_to_stats = false
# Songs played after the game is won don't count towards the statistics
if Settings.add_to_stats:
Settings.add_to_stats = false
stats_paused_by_win = true
func _on_player_removed(player_object: PlayerObject) -> void:
print("_on_player_removed ", player_object.player_name)