summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-08-09 22:08:16 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-08-09 22:08:16 +0200
commit52c4dc1dd7bbe6546e0a2b3eeb4b5ec78d3fb582 (patch)
treea8c5fd40b0b41abd6036888ad78b5b5083f0f66e /src/input
parentb2cbd720858d482257da98839a5c8ee8c85c6b62 (diff)
Updated point representation to better match my heavy bitfield usage
Diffstat (limited to 'src/input')
-rw-r--r--src/input/json.rs15
1 files changed, 8 insertions, 7 deletions
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() {