refactor: load/save state as ptr

This commit is contained in:
Ilia Denisov
2026-01-12 19:30:50 +02:00
parent ac60bb3020
commit 4451850f22
18 changed files with 71 additions and 57 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ type Battle struct {
BattleReport BattleReport
shipAmmo map[int]uint
attacker map[int]map[int]float64 // a group able to attack and destroy an opponent with some probability
attacker map[int]map[int]float64 // a group able to attack and destroy an opponent with some probability > 0
}
type BattleReport struct {
@@ -200,7 +200,7 @@ func SingleBattle(g *Game, b *Battle) {
case probability > 0:
destroyed = rand.Float64() >= probability
default:
panic("probabilities cache returned unexpected value")
panic("SingleBattle: probability unexpected: value <= 0")
}
b.BattleReport.BattleAction = append(b.BattleReport.BattleAction, BattleAction{