diff options
Diffstat (limited to 'src/engine/command.rs')
-rw-r--r-- | src/engine/command.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/engine/command.rs b/src/engine/command.rs new file mode 100644 index 0000000..603ee42 --- /dev/null +++ b/src/engine/command.rs @@ -0,0 +1,27 @@ +use std::fmt; +use super::geometry::Point; + +#[derive(Debug, Clone, Copy)] +pub enum Command { + Nothing, + Build(Point, BuildingType), +} + +impl fmt::Display for Command { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use Command::*; + + match self { + &Nothing => write!(f, ""), + &Build(p, b) => write!(f, "{},{},{}", p.x, p.y, b as u8), + } + } +} + +#[repr(u8)] +#[derive(Debug, Clone, Copy)] +pub enum BuildingType { + Defense = 0, + Attack = 1, + Energy = 2, +} |