summaryrefslogtreecommitdiff
path: root/src/engine/command.rs
blob: 603ee42ecdc47d5141a6d48b1758eaffabd079b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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,
}