summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/json.rs14
-rw-r--r--src/input/textmap.rs14
2 files changed, 14 insertions, 14 deletions
diff --git a/src/input/json.rs b/src/input/json.rs
index 3a3fbf2..ed00984 100644
--- a/src/input/json.rs
+++ b/src/input/json.rs
@@ -110,13 +110,13 @@ struct MissileState {
impl State {
fn to_engine_settings(&self) -> engine::settings::GameSettings {
- engine::settings::GameSettings {
- size: engine::geometry::Point::new(self.game_details.map_width, self.game_details.map_height),
- energy_income: self.game_details.round_income_energy,
- energy: self.game_details.buildings_stats.energy.to_engine(),
- defence: self.game_details.buildings_stats.defense.to_engine(),
- attack: self.game_details.buildings_stats.attack.to_engine(),
- }
+ engine::settings::GameSettings::new(
+ engine::geometry::Point::new(self.game_details.map_width, self.game_details.map_height),
+ self.game_details.round_income_energy,
+ self.game_details.buildings_stats.energy.to_engine(),
+ self.game_details.buildings_stats.defense.to_engine(),
+ self.game_details.buildings_stats.attack.to_engine(),
+ )
}
fn to_engine(&self, settings: &engine::settings::GameSettings) -> engine::GameState {
diff --git a/src/input/textmap.rs b/src/input/textmap.rs
index 79fbe7f..5481770 100644
--- a/src/input/textmap.rs
+++ b/src/input/textmap.rs
@@ -14,10 +14,10 @@ pub fn read_state_from_file(filename: &str) -> Result<(GameSettings, GameState),
//TODO actually read the right file and parse it?
- let engine_settings = GameSettings {
- size: Point::new(8,4),
- energy_income: 5,
- energy: BuildingSettings {
+ let engine_settings = GameSettings::new(
+ Point::new(8,4),
+ 5,
+ BuildingSettings {
price: 20,
health: 5,
construction_time: 2-2,
@@ -26,7 +26,7 @@ pub fn read_state_from_file(filename: &str) -> Result<(GameSettings, GameState),
weapon_cooldown_period: 0,
energy_generated_per_turn: 3
},
- defence: BuildingSettings {
+ BuildingSettings {
price: 30,
health: 20,
construction_time: 4-2,
@@ -35,7 +35,7 @@ pub fn read_state_from_file(filename: &str) -> Result<(GameSettings, GameState),
weapon_cooldown_period: 0,
energy_generated_per_turn: 0
},
- attack: BuildingSettings {
+ BuildingSettings {
price: 30,
health: 5,
construction_time: 2-2,
@@ -44,7 +44,7 @@ pub fn read_state_from_file(filename: &str) -> Result<(GameSettings, GameState),
weapon_cooldown_period: 3,
energy_generated_per_turn: 0
}
- };
+ );
let engine_state = GameState::new(
Player {
energy: 20,