diff options
Diffstat (limited to 'engines')
-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; |