Moved 'expressive' specific building logic out of generi code
authorJustin Worthe <justin@worthe-it.co.za>
Sat, 30 Jun 2018 14:10:40 +0000 (16:10 +0200)
committerJustin Worthe <justin@worthe-it.co.za>
Sat, 30 Jun 2018 14:10:40 +0000 (16:10 +0200)
src/engine/mod.rs
src/input/json.rs

index 65d6e24..2910b75 100644 (file)
@@ -33,13 +33,3 @@ pub struct Player {
     pub health: u8,
     pub energy_generated: u16,
 }
-
-impl Player {
-    pub fn new(energy: u16, health: u8, settings: &GameSettings, buildings: &[expressive_engine::Building]) -> Player {
-        Player {
-            energy,
-            health,
-            energy_generated: settings.energy_income + buildings.iter().map(|b| b.energy_generated_per_turn).sum::<u16>()
-        }
-    }
-}
index 3968afd..6f7cda1 100644 (file)
@@ -200,7 +200,11 @@ impl BuildingBlueprint {
 
 impl Player {
     fn to_engine(&self, settings: &engine::settings::GameSettings, buildings: &[expressive_engine::Building]) -> engine::Player {
-        engine::Player::new(self.energy, self.health, settings, buildings)
+        engine::Player {
+            energy: self.energy,
+            health: self.health,
+            energy_generated: settings.energy_income + buildings.iter().map(|b| b.energy_generated_per_turn).sum::<u16>()
+        }
     }
 }