Versus teams, gold for allies, fallen hearts as spectators, multi-mission editor co-op

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 19:59:43 +01:00
1 parent 811c955bad
commit fc9c49d4ca
16 files changed
+1896 -49

No files matched your search

+10 -2
View File
@@ -85,6 +85,11 @@ pub enum Act {
y: i32,
},
CancelOrders,
// gold for an allied master of a match (`crate::netplay::GOLD_ALL`: everything)
SendGold {
to: u8,
amount: u32,
},
}
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
@@ -97,7 +102,8 @@ pub struct Command {
impl Game {
// the local master orders something: queued until the next step boundary
pub fn queue(&mut self, act: Act) {
if self.state != 0 || self.paused || self.demo.is_some() || !self.is_master(self.local_side) {
// a master whose heart fell only watches
if self.state != 0 || self.paused || self.demo.is_some() || !self.is_master(self.local_side) || self.is_out(self.local_side) {
return;
}
let seq = self.cmd_seq;
@@ -109,7 +115,7 @@ impl Game {
// one command of one master: that master's state is switched in, the action runs, the local
// master's state is switched back. Messages, hints and sounds only come from the local master.
pub fn apply(&mut self, c: &Command) {
if !self.is_master(c.side) {
if !self.is_master(c.side) || self.is_out(c.side) {
return;
}
self.switch_to(c.side);
@@ -131,6 +137,7 @@ impl Game {
fn mark_command(&mut self, act: Act, side: u8) {
let ((x, y), kind, dur) = match act {
Act::SendGold { .. } => return, // nothing to point at on the map
Act::Dig(r) => (rect_center(r), MARK_DIG, 4.0),
Act::Room { r, .. } => (rect_center(r), MARK_ROOM, 5.0),
Act::Sell(r) => (rect_center(r), MARK_SELL, 4.0),
@@ -203,6 +210,7 @@ impl Game {
}
Act::Guard { x, y } => self.order_guard(x, y),
Act::CancelOrders => self.cancel_orders(),
Act::SendGold { to, amount } => self.send_gold(to, amount),
}
}
}