diff options
Diffstat (limited to 'server/protocol')
-rw-r--r-- | server/protocol/src/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs index 9c8d6bee..147a4fc3 100644 --- a/server/protocol/src/lib.rs +++ b/server/protocol/src/lib.rs @@ -17,7 +17,7 @@ */ use glam::{IVec2, Vec2}; use serde::{Deserialize, Serialize}; -use std::collections::HashSet; +use std::{collections::HashSet, fmt::Display}; pub use glam; @@ -170,3 +170,12 @@ pub enum ItemLocation { Tile(IVec2), Player(PlayerID), } + +impl Display for ItemLocation { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ItemLocation::Tile(pos) => write!(f, "tile({pos})"), + ItemLocation::Player(PlayerID(id)) => write!(f, "player({id})"), + } + } +} |