getFlag returns 0 and does not crash if the flag does is not set

This commit is contained in:
yairm210 2025-07-18 14:09:44 +03:00
parent 29d5b8375f
commit 237e286d4d

View File

@ -543,7 +543,8 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
flagsCountdown[flag.name] = amount
}
@Readonly fun getFlag(flag: DiplomacyFlags) = flagsCountdown[flag.name]!!
/** 0 indicates 'flag does not exist' */
@Readonly fun getFlag(flag: DiplomacyFlags) = flagsCountdown[flag.name] ?: 0
fun removeFlag(flag: DiplomacyFlags) {
flagsCountdown.remove(flag.name)
}