From 52c4dc1dd7bbe6546e0a2b3eeb4b5ec78d3fb582 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Thu, 9 Aug 2018 22:08:16 +0200 Subject: Updated point representation to better match my heavy bitfield usage --- src/input/json.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/input') diff --git a/src/input/json.rs b/src/input/json.rs index 3927a96..4aebcfa 100644 --- a/src/input/json.rs +++ b/src/input/json.rs @@ -73,11 +73,12 @@ impl State { for building in &cell.buildings { let building_type = building.convert_building_type(); - let (mut bitwise_buildings, bitfield) = if building.player_type == 'A' { - (&mut player_buildings, point.to_left_bitfield()) + let mut bitwise_buildings = if building.player_type == 'A' { + &mut player_buildings } else { - (&mut opponent_buildings, point.to_right_bitfield()) + &mut opponent_buildings }; + let bitfield = point.to_either_bitfield(); bitwise_buildings.occupied |= bitfield; if building.construction_time_left >= 0 { @@ -108,11 +109,11 @@ impl State { } } for missile in &cell.missiles { - let bitfields = point.to_bitfield(); - let (mut bitwise_buildings, mut left, mut right) = if missile.player_type == 'A' { - (&mut player_buildings, bitfields.0, bitfields.1) + let (mut left, mut right) = engine::geometry::Point::new_double_bitfield(cell.x, cell.y, missile.player_type == 'A'); + let mut bitwise_buildings = if missile.player_type == 'A' { + &mut player_buildings } else { - (&mut opponent_buildings, bitfields.1, bitfields.0) + &mut opponent_buildings }; for mut tier in bitwise_buildings.missiles.iter_mut() { -- cgit v1.2.3