summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-05-16 22:47:17 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-05-16 22:47:17 +0200
commitd5165efe843b7a1543f425087703266fd09501f4 (patch)
tree0dfc1422861396a78d2298f23610501d337def83 /src
parentc6a7a3154b7ba59f3abc7581b35dd460023cc8f9 (diff)
Changed types to assume health can't be more than the hundred in the
first round
Diffstat (limited to 'src')
-rw-r--r--src/engine/mod.rs8
-rw-r--r--src/engine/settings.rs4
-rw-r--r--src/json.rs12
3 files changed, 12 insertions, 12 deletions
diff --git a/src/engine/mod.rs b/src/engine/mod.rs
index 6bc200c..b03eda1 100644
--- a/src/engine/mod.rs
+++ b/src/engine/mod.rs
@@ -33,15 +33,15 @@ pub enum GameStatus {
#[derive(Debug, Clone, PartialEq)]
pub struct Player {
pub energy: u16,
- pub health: u16
+ pub health: u8
}
#[derive(Debug, Clone, PartialEq)]
pub struct Building {
pub pos: Point,
- pub health: u16,
+ pub health: u8,
pub construction_time_left: u8,
- pub weapon_damage: u16,
+ pub weapon_damage: u8,
pub weapon_speed: u8,
pub weapon_cooldown_time_left: u8,
pub weapon_cooldown_period: u8,
@@ -51,7 +51,7 @@ pub struct Building {
#[derive(Debug, Clone, PartialEq)]
pub struct Missile {
pub pos: Point,
- pub damage: u16,
+ pub damage: u8,
pub speed: u8,
}
diff --git a/src/engine/settings.rs b/src/engine/settings.rs
index b23d6bd..40256d9 100644
--- a/src/engine/settings.rs
+++ b/src/engine/settings.rs
@@ -13,9 +13,9 @@ pub struct GameSettings {
#[derive(Debug)]
pub struct BuildingSettings {
pub price: u16,
- pub health: u16,
+ pub health: u8,
pub construction_time: u8,
- pub weapon_damage: u16,
+ pub weapon_damage: u8,
pub weapon_speed: u8,
pub weapon_cooldown_period: u8,
pub energy_generated_per_turn: u16
diff --git a/src/json.rs b/src/json.rs
index 239a351..2eb2278 100644
--- a/src/json.rs
+++ b/src/json.rs
@@ -48,9 +48,9 @@ struct BuildingStats {
#[serde(rename_all = "camelCase")]
struct BuildingBlueprint {
price: u16,
- health: u16,
+ health: u8,
construction_time: u8,
- weapon_damage: u16,
+ weapon_damage: u8,
weapon_speed: u8,
weapon_cooldown_period: u8,
energy_generated_per_turn: u16,
@@ -63,7 +63,7 @@ struct BuildingBlueprint {
struct Player {
player_type: char,
energy: u16,
- health: u16,
+ health: u8,
//hits_taken: u32,
//score: u32
}
@@ -81,10 +81,10 @@ struct GameCell {
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct BuildingState {
- health: u16,
+ health: u8,
construction_time_left: i8,
//price: u16,
- weapon_damage: u16,
+ weapon_damage: u8,
weapon_speed: u8,
weapon_cooldown_time_left: u8,
weapon_cooldown_period: u8,
@@ -100,7 +100,7 @@ struct BuildingState {
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct MissileState {
- damage: u16,
+ damage: u8,
speed: u8,
x: u8,
y: u8,