Manual AI seats for matches: host toggles empty seats, co-op allies fight heroes

This commit is contained in:
Richard Zink committed 2026-11-05 06:38:38 +01:00
1 parent 3492eacd59
commit ee7b76fa6a
10 files changed
+308 -43

No files matched your search

+6 -5
View File
@@ -248,6 +248,7 @@ fn account_action(a: MenuAction, cloud: &mut Cloud, menu: &mut Menu, app: &mut A
}
}
MenuAction::MatchTakeSide(side) => app.client.take_side(side),
MenuAction::MatchSetAi(side, ai) => app.client.set_ai(side, ai),
MenuAction::MatchReady(ready) => app.client.ready(ready),
MenuAction::MatchStart => app.client.start(),
MenuAction::MatchResume => app.client.resume(),
@@ -518,6 +519,7 @@ impl App {
return false;
}
game.ai_difficulty = info.difficulty;
game.sync_ai_sides(&info.ai, info.difficulty);
game.hints = self.settings.hints;
self.game = game;
let (cx, cy) = self.game.map.core;
@@ -537,6 +539,7 @@ impl App {
}
self.game.coop = false;
self.game.ai_difficulty = info.difficulty;
self.game.sync_ai_sides(&info.ai, info.difficulty);
self.game.hints = self.settings.hints;
self.game.init_fog();
let (cx, cy) = self.game.map.core;
@@ -552,11 +555,8 @@ impl App {
return;
}
for (_, cmds, ai) in self.client.take_turns() {
if self.coop {
self.game.ai_sides.clear();
} else {
self.game.sync_ai_sides(&ai, self.settings.difficulty);
}
let difficulty = self.game.ai_difficulty;
self.game.sync_ai_sides(&ai, difficulty);
self.game.receive_turn(&cmds);
}
for (_, turn, sum) in self.client.take_checks() {
@@ -1098,6 +1098,7 @@ async fn main() {
| MenuAction::MatchCreate
| MenuAction::MatchCoopCreate(..)
| MenuAction::MatchTakeSide(..)
| MenuAction::MatchSetAi(..)
| MenuAction::MatchReady(..)
| MenuAction::MatchStart
| MenuAction::MatchResume