mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-30 07:23:05 +00:00
TITANIC: Fix crash inserting photograph into star control
This commit is contained in:
parent
d6645f3fc9
commit
0be151d507
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user