summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-06-25 17:37:14 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-06-25 17:37:14 +0200
commitf1f81abab3ca1c1f97ccd52e99c3977905312d94 (patch)
tree3cd65a438af59a26a940a32a0fdee167f3736965 /src/input
parentf5699c057c000efd80e4bf7dd6b23a0d1750e628 (diff)
Added new tower type and deconstruct action
Diffstat (limited to 'src/input')
-rw-r--r--src/input/json.rs4
-rw-r--r--src/input/mod.rs1
-rw-r--r--src/input/textmap.rs69
3 files changed, 3 insertions, 71 deletions
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<Error>> {
- 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))
-}