diff options
author | Colin Snover | 2017-11-16 10:31:59 -0600 |
---|---|---|
committer | Eugene Sandulenko | 2017-11-18 22:35:12 +0100 |
commit | 715d4bd76ab749b88f888ea8196ce252de6140ad (patch) | |
tree | e781ceb72a4061dbd2cc4c96cd921c1aaf60737e /engines/fullpipe/motion.h | |
parent | 6a13592633a6a4cf935409edd1c5504ef7dfa75e (diff) | |
download | scummvm-rg350-715d4bd76ab749b88f888ea8196ce252de6140ad.tar.gz scummvm-rg350-715d4bd76ab749b88f888ea8196ce252de6140ad.tar.bz2 scummvm-rg350-715d4bd76ab749b88f888ea8196ce252de6140ad.zip |
FULLPIPE: Fix memory leaks, ownership issues with various point lists
Diffstat (limited to 'engines/fullpipe/motion.h')
-rw-r--r-- | engines/fullpipe/motion.h | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 2a1450eb71..b47cff9a13 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -70,13 +70,9 @@ public: class MovGraphReact : public CObject { public: - int _pointCount; - Common::Point **_points; + PointList _points; public: - MovGraphReact() : _pointCount(0), _points(0) {} - ~MovGraphReact() { free(_points); } - virtual void setCenter(int x1, int y1, int x2, int y2) {} virtual void createRegion() {} virtual bool pointInRegion(int x, int y); @@ -200,20 +196,19 @@ public: }; class ReactPolygonal : public MovGraphReact { - Common::Rect *_bbox; + Common::Rect _bbox; int _centerX; int _centerY; public: ReactPolygonal(); - ~ReactPolygonal(); virtual bool load(MfcArchive &file); virtual void setCenter(int x1, int y1, int x2, int y2); virtual void createRegion(); - void getBBox(Common::Rect *rect); + Common::Rect getBBox(); }; class MovGraphLink : public CObject { @@ -238,6 +233,7 @@ class MovGraphLink : public CObject { void recalcLength(); }; +typedef Common::Array<MovGraphLink *> MovGraphLinkList; struct MovStep { int sfield_0; @@ -315,7 +311,7 @@ public: MovGraphNode *calcOffset(int ox, int oy); int getObjectIndex(StaticANIObject *ani); Common::Array<MovArr *> *getHitPoints(int x, int y, int *arrSize, int flag1, int flag2); - void findAllPaths(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array<MovGraphLink *> &tempObList1, Common::Array<MovGraphLink *> &tempObList2); + void findAllPaths(MovGraphLink *lnk, MovGraphLink *lnk2, MovGraphLinkList &tempObList1, MovGraphLinkList &tempObList2); Common::Array<MovItem *> *getPaths(MovArr *movarr1, MovArr *movarr2, int *listCount); void genMovItem(MovItem *movitem, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2); bool getHitPoint(int idx, int x, int y, MovArr *arr, int a6); @@ -361,12 +357,10 @@ struct MctlMQ { int distance2; int subIndex; int item1Index; - Common::Array<MctlMQSub *> items; - int itemsCount; + Common::Array<MctlMQSub> items; int flags; MctlMQ() { clear(); } - MctlMQ(MctlMQ *src); void clear(); }; @@ -378,7 +372,7 @@ struct MctlAni { // 744 class MctlGraph : public MovGraph { public: - Common::Array<MctlAni *> _items2; + Common::Array<MctlAni> _items2; public: virtual void attachObject(StaticANIObject *obj); @@ -393,16 +387,16 @@ public: int getDirByPoint(int idx, StaticANIObject *ani); int getDirBySize(MovGraphLink *lnk, int x, int y); - int getLinkDir(Common::Array<MovGraphLink *> *linkList, int idx, Common::Rect *a3, Common::Point *a4); + int getLinkDir(MovGraphLinkList *linkList, int idx, Common::Rect *a3, Common::Point *a4); - bool fillData(StaticANIObject *obj, MctlAni *item); - void generateList(MctlMQ *movinfo, Common::Array<MovGraphLink *> *linkList, LinkInfo *lnkSrc, LinkInfo *lnkDst); - MessageQueue *makeWholeQueue(MctlMQ *mctlMQ); + bool fillData(StaticANIObject *obj, MctlAni &item); + void generateList(MctlMQ &movinfo, MovGraphLinkList *linkList, LinkInfo *lnkSrc, LinkInfo *lnkDst); + MessageQueue *makeWholeQueue(MctlMQ &mctlMQ); MovGraphNode *getHitNode(int x, int y, int strictMatch); MovGraphLink *getHitLink(int x, int y, int idx, int fuzzyMatch); MovGraphLink *getNearestLink(int x, int y); - double iterate(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, Common::Array<MovGraphLink *> *listObj); + double iterate(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, MovGraphLinkList *listObj); MessageQueue *makeLineQueue(MctlMQ *movinfo); }; |