diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-12-08 22:02:19 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-12-08 22:02:19 +0200 |
commit | 1e21ebed15321aacbba53121cb40bbc60f4db1cc (patch) | |
tree | 1d0f07ce61e138c717b96b9692bc2329bb590dd1 /src/engine | |
parent | f6611aab7c696520d9be5dfe29303fd6e0ade0d7 (diff) |
Renamed variable to be more concise
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/bitwise_engine.rs | 10 | ||||
-rw-r--r-- | src/engine/geometry.rs | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/engine/bitwise_engine.rs b/src/engine/bitwise_engine.rs index f03f1c0..694a309 100644 --- a/src/engine/bitwise_engine.rs +++ b/src/engine/bitwise_engine.rs @@ -224,7 +224,7 @@ impl BitwiseGameState { player.energy -= TESLA_FIRING_ENERGY; tesla.cooldown = TESLA_COOLDOWN; - if tesla.pos.to_either_bitfield() & RIGHT_COL_MASK != 0 { + if tesla.pos.to_bitfield() & RIGHT_COL_MASK != 0 { opponent.health = opponent.health.saturating_sub(TESLA_DAMAGE); } @@ -291,7 +291,7 @@ impl BitwiseGameState { fn update_tesla_activity(buildings: &mut Player) { let occupied = buildings.occupied; - buildings.tesla_cooldowns.retain(|t| (t.pos.to_either_bitfield() & occupied) != 0); + buildings.tesla_cooldowns.retain(|t| (t.pos.to_bitfield() & occupied) != 0); } @@ -356,7 +356,7 @@ impl Player { pub fn location_of_unoccupied_cell(&self, i: usize) -> Point { let bit = find_bit_index_from_rank(self.occupied, i as u64); let point = Point { index: bit }; - debug_assert!(point.to_either_bitfield() & self.occupied == 0); + debug_assert!(point.to_bitfield() & self.occupied == 0); point } @@ -365,7 +365,7 @@ impl Player { match command { Command::Nothing => {}, Command::Build(p, b) => { - let bitfield = p.to_either_bitfield(); + let bitfield = p.to_bitfield(); let price = match b { BuildingType::Attack => MISSILE_PRICE, @@ -415,7 +415,7 @@ impl Player { let health = if building_type == BuildingType::Defence { DEFENCE_HEALTH } else { 1 }; let pos = self.unconstructed[i].pos; - let bitfield = pos.to_either_bitfield(); + let bitfield = pos.to_bitfield(); for health_tier in 0..health { self.buildings[health_tier] |= bitfield; diff --git a/src/engine/geometry.rs b/src/engine/geometry.rs index b8b38dd..9cd1d90 100644 --- a/src/engine/geometry.rs +++ b/src/engine/geometry.rs @@ -24,7 +24,7 @@ impl Point { } pub fn new_double_bitfield(x: u8, y: u8, is_left_player: bool) -> (u64, u64) { - let bitfield = Point::new(x, y).to_either_bitfield(); + let bitfield = Point::new(x, y).to_bitfield(); if (x >= SINGLE_MAP_WIDTH) == is_left_player { (0, bitfield) } else { @@ -51,7 +51,7 @@ impl Point { * This involves mirroring the x dimension for the opponent's side */ - pub fn to_either_bitfield(self) -> u64 { + pub fn to_bitfield(self) -> u64 { 1u64 << self.index } } |