Ensure proper initialization of all Arrays and Dictionaries

This commit is contained in:
Adrien Ufferte
2025-05-05 10:52:37 +02:00
parent a6c37a7f0b
commit 0bfead86e0
53 changed files with 100 additions and 101 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ enum EducationMethod {
@export var account_type: AccountType
@export var education_method: EducationMethod
var devices_count: int
@export var students: Dictionary # int : Array[StudentData]
@export var students: Dictionary[int, Array] = {} # int : Array[StudentData]
@export var email: String
var password: String
@export var token: String
@@ -50,7 +50,7 @@ func update_from_dict(dict: Dictionary) -> void:
students[int(device)] = device_students
func get_new_code() -> int :
var used_codes: Array[int]
var used_codes: Array[int] = []
for student_array: Array[StudentData] in students.values():
for student: StudentData in student_array:
used_codes.append(student.code)
+1 -1
View File
@@ -13,7 +13,7 @@ var consecutives_losses: int = 0
@export
var consecutives_wins: int = 0
@export
var history: Array[bool]
var history: Array[bool] = []
func add_game(is_won: bool) -> void:
history.append(is_won)
+1 -1
View File
@@ -4,7 +4,7 @@ class_name UserSpeeches
signal speeches_changed
# Contains the list of speeches already played
@export var speeches_played: Array[String]
@export var speeches_played: Array[String] = []
func add_speech(speech: String) -> void:
if not speeches_played.has(speech):