diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/star_control/star_control_sub8.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_ref.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/star_ref.h | 6 |
3 files changed, 8 insertions, 6 deletions
diff --git a/engines/titanic/star_control/star_control_sub8.cpp b/engines/titanic/star_control/star_control_sub8.cpp index 23a65e8702..470b357c00 100644 --- a/engines/titanic/star_control/star_control_sub8.cpp +++ b/engines/titanic/star_control/star_control_sub8.cpp @@ -98,7 +98,7 @@ bool CStarControlSub8::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CSt if (count > 0) { allocate(count); - CStarRef2 starRef(starField, &_positions); + CStarRefArray starRef(starField, &_positions); starRef.process(surfaceArea, camera); return true; } else { diff --git a/engines/titanic/star_control/star_ref.cpp b/engines/titanic/star_control/star_ref.cpp index 185c953a83..6f68a6c8ae 100644 --- a/engines/titanic/star_control/star_ref.cpp +++ b/engines/titanic/star_control/star_ref.cpp @@ -92,14 +92,16 @@ bool CStarRef1::check(const Common::Point &pt, int index) { /*------------------------------------------------------------------------*/ -bool CStarRef2::check(const Common::Point &pt, int index) { +bool CStarRefArray::check(const Common::Point &pt, int index) { if (_index >= (int)_positions->size()) + // Positions array full, so ignore return false; - CStarPosition &sp = (*_positions)[index]; + CStarPosition &sp = (*_positions)[_index++]; sp.x = pt.x; sp.y = pt.y; sp._index1 = sp._index2 = index; + return true; } diff --git a/engines/titanic/star_control/star_ref.h b/engines/titanic/star_control/star_ref.h index cb94555dcd..4e66db061f 100644 --- a/engines/titanic/star_control/star_ref.h +++ b/engines/titanic/star_control/star_ref.h @@ -56,15 +56,15 @@ public: virtual bool check(const Common::Point &pt, int index); }; -class CStarRef2 : public CBaseStarRef { +class CStarRefArray : public CBaseStarRef { private: Common::Array<CStarPosition> *_positions; public: int _index; public: - CStarRef2(CBaseStars *stars, Common::Array<CStarPosition> *positions) : + CStarRefArray(CBaseStars *stars, Common::Array<CStarPosition> *positions) : CBaseStarRef(stars), _positions(positions), _index(0) {} - virtual ~CStarRef2() {} + virtual ~CStarRefArray() {} virtual bool check(const Common::Point &pt, int index); }; |