summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-07-04 19:37:35 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-07-04 19:37:35 +0200
commitd0b2740ddea28b20fd26d7dbd19149a76df129ff (patch)
tree07e93267d0b9831b079d9348a0c47be9b130c73c /src
parente051d9bd5554620f7f53d34f6f84331235cfb3cd (diff)
Added tests of indexing into random bitwise building
Diffstat (limited to 'src')
-rw-r--r--src/engine/bitwise_engine.rs3
-rw-r--r--src/engine/geometry.rs2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/engine/bitwise_engine.rs b/src/engine/bitwise_engine.rs
index 31040bf..524ddf7 100644
--- a/src/engine/bitwise_engine.rs
+++ b/src/engine/bitwise_engine.rs
@@ -146,6 +146,9 @@ impl BitwiseGameState {
self.opponent_buildings.missiles[j].1 &= !move_down4;
}
}
+
+ self.player_buildings.unconstructed.sort_by_key(|b| b.pos);
+ self.opponent_buildings.unconstructed.sort_by_key(|b| b.pos);
}
pub fn sorted(&self) -> BitwiseGameState {
diff --git a/src/engine/geometry.rs b/src/engine/geometry.rs
index 02fe44b..af91b19 100644
--- a/src/engine/geometry.rs
+++ b/src/engine/geometry.rs
@@ -81,6 +81,6 @@ impl PartialOrd for Point {
}
impl Ord for Point {
fn cmp(&self, other: &Point) -> Ordering {
- self.x.cmp(&other.x).then(self.y.cmp(&other.y))
+ self.y.cmp(&other.y).then(self.x.cmp(&other.x))
}
}