From f1f81abab3ca1c1f97ccd52e99c3977905312d94 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Mon, 25 Jun 2018 17:37:14 +0200 Subject: Added new tower type and deconstruct action --- src/input/json.rs | 4 ++- src/input/mod.rs | 1 - src/input/textmap.rs | 69 ---------------------------------------------------- 3 files changed, 3 insertions(+), 71 deletions(-) delete mode 100644 src/input/textmap.rs (limited to 'src/input') diff --git a/src/input/json.rs b/src/input/json.rs index ed00984..95dbd46 100644 --- a/src/input/json.rs +++ b/src/input/json.rs @@ -41,7 +41,8 @@ struct GameDetails { struct BuildingStats { energy: BuildingBlueprint, defense: BuildingBlueprint, - attack: BuildingBlueprint + attack: BuildingBlueprint, + tesla: BuildingBlueprint, } #[derive(Deserialize)] @@ -116,6 +117,7 @@ impl State { self.game_details.buildings_stats.energy.to_engine(), self.game_details.buildings_stats.defense.to_engine(), self.game_details.buildings_stats.attack.to_engine(), + self.game_details.buildings_stats.tesla.to_engine(), ) } diff --git a/src/input/mod.rs b/src/input/mod.rs index 47f359a..22fdbb3 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1,2 +1 @@ pub mod json; -pub mod textmap; diff --git a/src/input/textmap.rs b/src/input/textmap.rs deleted file mode 100644 index 5481770..0000000 --- a/src/input/textmap.rs +++ /dev/null @@ -1,69 +0,0 @@ -use std::fs::File; -use std::io::prelude::*; -use std::error::Error; - -use ::engine::*; -use ::engine::settings::*; -use ::engine::geometry::*; - - -pub fn read_state_from_file(filename: &str) -> Result<(GameSettings, GameState), Box> { - let mut file = File::open(filename)?; - let mut content = String::new(); - file.read_to_string(&mut content)?; - - //TODO actually read the right file and parse it? - - let engine_settings = GameSettings::new( - Point::new(8,4), - 5, - BuildingSettings { - price: 20, - health: 5, - construction_time: 2-2, - weapon_damage: 0, - weapon_speed: 0, - weapon_cooldown_period: 0, - energy_generated_per_turn: 3 - }, - BuildingSettings { - price: 30, - health: 20, - construction_time: 4-2, - weapon_damage: 0, - weapon_speed: 0, - weapon_cooldown_period: 0, - energy_generated_per_turn: 0 - }, - BuildingSettings { - price: 30, - health: 5, - construction_time: 2-2, - weapon_damage: 5, - weapon_speed: 2, - weapon_cooldown_period: 3, - energy_generated_per_turn: 0 - } - ); - let engine_state = GameState::new( - Player { - energy: 20, - health: 100, - energy_generated: 5 - }, - Player { - energy: 20, - health: 100, - energy_generated: 5 - }, - Vec::new(), - Vec::new(), - Vec::new(), - Vec::new(), - Vec::new(), - Vec::new(), - &engine_settings - ); - - Ok((engine_settings, engine_state)) -} -- cgit v1.2.3