diff options
Diffstat (limited to 'games/rstnode/rst-core/src/_match.rs')
-rw-r--r-- | games/rstnode/rst-core/src/_match.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/games/rstnode/rst-core/src/_match.rs b/games/rstnode/rst-core/src/_match.rs index ce75af5af393..e1cc45374ebc 100644 --- a/games/rstnode/rst-core/src/_match.rs +++ b/games/rstnode/rst-core/src/_match.rs @@ -1,8 +1,9 @@ use crate::{ data::Player, lobby::MetaLobby, + mailbox::{Inbox, Outbox}, map::Map, - wire::{Action, LobbyUser, MatchId, UserId}, + wire::{game::Action, LobbyUser, MatchId, UserId}, }; use async_std::sync::{Arc, RwLock}; use chrono::{DateTime, Utc}; @@ -23,7 +24,9 @@ pub struct Match { /// The active game map pub map: Map, /// Input inbox (handled in-order each game tick) - inbox: RwLock<VecDeque<Action>>, + inbox: Inbox, + /// Update outbox + outbox: Outbox, /// The time the match was initialised init_t: DateTime<Utc>, /// The synced time the match was started @@ -46,7 +49,8 @@ impl From<MetaLobby> for Match { }) .collect(), map: Map::new(), - inbox: Default::default(), + inbox: Inbox::new(), + outbox: Outbox::new(), init_t: Utc::now(), start_t: None, } @@ -61,7 +65,7 @@ impl Match { /// Queue a new game action pub async fn queue(&self, cmd: Action) { - self.inbox.write().await.push_back(cmd); + self.inbox.queue(cmd).await; } pub async fn handle_inbox(&mut self) { |