summaryrefslogtreecommitdiff
path: root/src/actions.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin.worthe@gmail.com>2017-06-18 15:15:11 +0200
committerJustin Worthe <justin.worthe@gmail.com>2017-06-18 15:15:11 +0200
commit862897ea1d183810c2783eaeeaf40f648ef3dc2d (patch)
treefb168f1122fa2839b52443c54555593045262a2a /src/actions.rs
parent29181fce4797b6e4833ab56d1fa7ff9fa865965b (diff)
Added knowledge of weapons
Next step: knowledge of weapon's effects.
Diffstat (limited to 'src/actions.rs')
-rw-r--r--src/actions.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/actions.rs b/src/actions.rs
index 2291de6..ae1f6ce 100644
--- a/src/actions.rs
+++ b/src/actions.rs
@@ -8,13 +8,13 @@ use std::collections::HashSet;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
pub enum Action {
PlaceShips(Vec<ShipPlacement>),
- Shoot(Point)
+ Shoot(Weapon, Point)
}
impl fmt::Display for Action {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
- &Action::Shoot(p) => writeln!(f, "1,{},{}", p.x, p.y),
+ &Action::Shoot(w, p) => writeln!(f, "{},{},{}", w, p.x, p.y),
&Action::PlaceShips(ref ships) => ships.iter().map(|ref ship| {
writeln!(f, "{} {} {} {}", ship.ship_type, ship.point.x, ship.point.y, ship.direction)
}).fold(Ok(()), |acc, next| acc.and(next))