[Scummvm-git-logs] scummvm master -> 8c3ebe9af4e04618918ca353d008d38b66ca18f5
mduggan
mgithub at guarana.org
Wed Mar 25 13:41:27 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8c3ebe9af4 ULTIMA8: Correct Box.InBox boundary conditions
Commit: 8c3ebe9af4e04618918ca353d008d38b66ca18f5
https://github.com/scummvm/scummvm/commit/8c3ebe9af4e04618918ca353d008d38b66ca18f5
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-03-25T22:38:26+09:00
Commit Message:
ULTIMA8: Correct Box.InBox boundary conditions
The boundary conditions were reversed in Box.Inbox when compared with
Box.Overlaps. Since InBox is not being used and Overlaps is, I went with the
definitions from Overlaps. Also configured unit tests to exercise this
behavior.
Changed paths:
engines/ultima/ultima8/misc/box.h
test/engines/ultima/ultima8/misc/box.h
diff --git a/engines/ultima/ultima8/misc/box.h b/engines/ultima/ultima8/misc/box.h
index 855d9f4df0..a7e819e189 100644
--- a/engines/ultima/ultima8/misc/box.h
+++ b/engines/ultima/ultima8/misc/box.h
@@ -56,8 +56,8 @@ struct Box {
// Check to see if a point is within the Box
bool InBox(int px, int py, int pz) const {
- return (px >= (_x - _xd) && py >= (_y - _yd) && pz >= _z &&
- px < _x && py < _y && pz < (_z + _zd));
+ return (px > (_x - _xd) && py > (_y - _yd) && pz >= _z &&
+ px <= _x && py <= _y && pz < (_z + _zd));
}
// Move the Box (Relative)
diff --git a/test/engines/ultima/ultima8/misc/box.h b/test/engines/ultima/ultima8/misc/box.h
index c6da553336..96367eb67b 100644
--- a/test/engines/ultima/ultima8/misc/box.h
+++ b/test/engines/ultima/ultima8/misc/box.h
@@ -24,16 +24,13 @@ class U8BoxTestSuite : public CxxTest::TestSuite {
TS_ASSERT(box.IsValid());
TS_ASSERT(box.Overlaps(box));
TS_ASSERT(box == box);
- // TODO: All these tests are disabled becasue the box uses reversed
- // coordinates in x and y.. need to confirm if that's the correct
- // behavior
- /*
- TS_ASSERT(box.InBox(0,0,1));
- TS_ASSERT(box.InBox(0,1,0));
- TS_ASSERT(box.InBox(1,0,0));
+
+ // Note: These tests expect Box has reversed coordinates in x and y.
+ TS_ASSERT(box.InBox(-1,-1,1));
+ TS_ASSERT(box.InBox(-1,-1,0));
box.MoveRel(0, 0, 1);
- TS_ASSERT(!box.InBox(0,0,1));
- TS_ASSERT(box.InBox(0,0,2));
+ TS_ASSERT(!box.InBox(-1,-1,0));
+ TS_ASSERT(box.InBox(-1,-1,2));
Ultima::Ultima8::Box box2(box);
TS_ASSERT(box == box2);
@@ -45,9 +42,8 @@ class U8BoxTestSuite : public CxxTest::TestSuite {
TS_ASSERT(!(box2 == box3));
TS_ASSERT(box2.Overlaps(box3));
TS_ASSERT(box3.Overlaps(box2));
- box3.ResizeAbs(1,2,2);
+ box3.ResizeAbs(1,1,1);
TS_ASSERT(!box3.Overlaps(box2));
- */
}
};
More information about the Scummvm-git-logs
mailing list