summaryrefslogtreecommitdiff
path: root/src/engine/command.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-05-05 20:37:53 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-05-05 20:37:53 +0200
commit057a4fe886848322adf4e48ad9709a289434dc1b (patch)
tree5651d000fc642387d8c8e1ea410a26d4e7e7689f /src/engine/command.rs
Initial commit with sample bot and embedded game engine
Diffstat (limited to 'src/engine/command.rs')
-rw-r--r--src/engine/command.rs27
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,
+}