keep the two summoners in the opening state

LogicBattle::resetSimulatedManaTimers reads both leaders out of the
battle at +96 and +104 and calls a virtual on each without a null check,
so an opening state with no leaders segfaults inside LogicGameMode
::decode before anything else happens.

so the opening state carries the two king towers and nothing else. they
are the objects that cannot get a model - the battle screen, and with it
the listener, does not exist yet - and they are also the pair the hud
caches at [SpellButton+0x1d0], so they are exactly the objects that must
not be replaced later either. everything else, princess towers included,
now arrives after the screen is up.
This commit is contained in:
WiseDev 2026-08-23 14:53:41 +03:00
parent cb5b04f3ca
commit 0c4d0965a6

View file

@ -60,8 +60,11 @@ impl BattleSession {
} }
fn opening(&self) -> LogicGameMode { fn opening(&self) -> LogicGameMode {
let mut mode = self.mode.clone(); let mut mode = self.mode.clone();
mode.battle.objects.objects.clear(); let leaders = mode.battle.leaders;
mode.battle.leaders = Default::default(); mode.battle
.objects
.objects
.retain(|entry| leaders.contains(&entry.global_id));
mode.battle.leader_towers = Default::default(); mode.battle.leader_towers = Default::default();
mode mode
} }