feat: add messages enums

This commit is contained in:
2026-08-14 18:21:46 +02:00
parent 6f940b784e
commit 7b4fc568a1
7 changed files with 38 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
mod board;
pub mod board;
pub mod game_master;
mod math;
pub mod math;
mod player;

View File

@@ -1,4 +1,5 @@
mod logic;
mod network;
fn main() {
println!("Hello, world!");

0
src/network/client.rs Normal file
View File

View File

31
src/network/message.rs Normal file
View File

@@ -0,0 +1,31 @@
use uuid::Uuid;
use crate::logic::{
board::{
board::Board,
pawn::{CapturePath, MovePath},
},
game_master::GameResult,
math::position::Position,
};
pub enum ServerMessage {
RequestHandshake,
AcceptHandshake { player_id: Uuid },
DeclineHandshake { reason: String },
AvailableCaptures { captures: Vec<CapturePath> },
AvailableMoves { moves: Vec<MovePath> },
BroadcastBoardState { board: Board },
BroadcastCurrentTurn { active_player: Uuid },
GameEnd { result: GameResult },
}
pub enum ClientMessage {
AnswerHandshake { player_name: String },
RequestCapture { capture_path: CapturePath },
RequestMove { from: Position, to: Position },
}

4
src/network/mod.rs Normal file
View File

@@ -0,0 +1,4 @@
mod client;
mod connection;
mod message;
mod server;

0
src/network/server.rs Normal file
View File