Skip to content

Commit 1af152e

Browse files
committed
fix(level): fix integrity check calculations
commit 0080fb9 negates the y-coordinates on load/save, this means the integrity checks must be changed to take this into account. This is the same as Elmanager does.
1 parent 86f210a commit 1af152e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lev.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ impl Level {
752752

753753
for poly in &self.polygons {
754754
for vertex in &poly.vertices {
755-
pol_sum += vertex.x + vertex.y;
755+
pol_sum += vertex.x - vertex.y;
756756
}
757757
}
758758

@@ -763,11 +763,11 @@ impl Level {
763763
ObjectType::Killer => 3,
764764
ObjectType::Player => 4,
765765
};
766-
obj_sum += obj.position.x + obj.position.y + f64::from(obj_type);
766+
obj_sum += obj.position.x - obj.position.y + f64::from(obj_type);
767767
}
768768

769769
for pic in &self.pictures {
770-
pic_sum += pic.position.x + pic.position.y;
770+
pic_sum += pic.position.x - pic.position.y;
771771
}
772772

773773
let sum = (pol_sum + obj_sum + pic_sum) * 3_247.764_325_643;

0 commit comments

Comments
 (0)