diff options
author | Paul Gilbert | 2017-03-09 20:50:56 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-03-09 20:50:56 -0500 |
commit | 3e1d298a61071709a40a0fd96c774a28602df5d2 (patch) | |
tree | 563d34bc8318ed1d6777716973a72c35cef581f2 /engines/titanic/star_control | |
parent | 6bb953e25bca80f763f8cd7c2df1863a529ba889 (diff) | |
download | scummvm-rg350-3e1d298a61071709a40a0fd96c774a28602df5d2.tar.gz scummvm-rg350-3e1d298a61071709a40a0fd96c774a28602df5d2.tar.bz2 scummvm-rg350-3e1d298a61071709a40a0fd96c774a28602df5d2.zip |
TITANIC: Properly implement CBaseStarEntry equality test
Diffstat (limited to 'engines/titanic/star_control')
-rw-r--r-- | engines/titanic/star_control/base_star.cpp | 9 | ||||
-rw-r--r-- | engines/titanic/star_control/base_star.h | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub7.cpp | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp index a32263a926..552ef17762 100644 --- a/engines/titanic/star_control/base_star.cpp +++ b/engines/titanic/star_control/base_star.cpp @@ -44,6 +44,15 @@ void CBaseStarEntry::load(Common::SeekableReadStream &s) { _data[idx] = s.readUint32LE(); } +bool CBaseStarEntry::operator==(const CBaseStarEntry &s) const { + return _field0 == s._field0 && _field1 == s._field1 + && _field2 == s._field2 && _field3 == s._field3 + && _value == s._value && _position == s._position + && _data[0] == s._data[0] && _data[1] == s._data[1] + && _data[2] == s._data[2] && _data[3] == s._data[3] + && _data[4] == s._data[4]; +} + /*------------------------------------------------------------------------*/ CBaseStar::CBaseStar() : _minVal(0.0), _maxVal(1.0), _range(0.0), diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h index 1450b25bb3..c348b1fe12 100644 --- a/engines/titanic/star_control/base_star.h +++ b/engines/titanic/star_control/base_star.h @@ -44,7 +44,13 @@ struct CBaseStarEntry { uint _data[5]; CBaseStarEntry(); + + /** + * Loads the data for a star + */ void load(Common::SeekableReadStream &s); + + bool operator==(const CBaseStarEntry &s) const; }; class CBaseStar { diff --git a/engines/titanic/star_control/star_control_sub7.cpp b/engines/titanic/star_control/star_control_sub7.cpp index 4b694810ad..c2c9030700 100644 --- a/engines/titanic/star_control/star_control_sub7.cpp +++ b/engines/titanic/star_control/star_control_sub7.cpp @@ -32,7 +32,7 @@ bool CStarControlSub7::addStar(const CBaseStarEntry *entry) { // iterate through the existing stars for (uint idx = 0; idx < _data.size(); ++idx) { CBaseStarEntry &star = _data[idx]; - if (star._position == entry->_position) { + if (star == *entry) { // Found a matching star at the exact same position, so remove it instead _data.remove_at(idx); return true; |