diff options
author | Eugene Sandulenko | 2013-12-21 22:36:19 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2013-12-21 22:36:19 +0200 |
commit | 5f699929c85bc14cbcba8197f58c71ec1ffe5d8e (patch) | |
tree | ae65fe0d2dcfca0cd14b7efc27fe93c4297b5881 /engines/fullpipe | |
parent | eeca348953d851d11f98b9b78d9bba0043937614 (diff) | |
download | scummvm-rg350-5f699929c85bc14cbcba8197f58c71ec1ffe5d8e.tar.gz scummvm-rg350-5f699929c85bc14cbcba8197f58c71ec1ffe5d8e.tar.bz2 scummvm-rg350-5f699929c85bc14cbcba8197f58c71ec1ffe5d8e.zip |
FULLPIPE: Do not memcpy non-POD objects.
Thanks to eriktorbjorn for finding out.
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/motion.cpp | 32 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 4 |
2 files changed, 32 insertions, 4 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 1ecb973066..56ef4782d4 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -354,6 +354,32 @@ MctlConnectionPoint::~MctlConnectionPoint() { delete _messageQueueObj; } +MovInfo1::MovInfo1(MovInfo1 *src) { + field_0 = src->field_0; + pt1 = src->pt1; + pt2 = src->pt2; + distance1 = src->distance1; + distance2 = src->distance2; + subIndex = src->subIndex; + item1Index = src->item1Index; + items = src->items; + itemsCount = src->itemsCount; + flags = src->flags; +} + +void MovInfo1::clear() { + field_0 = 0; + pt1.x = pt1.y = 0; + pt2.x = pt2.y = 0; + distance1 = 0; + distance2 = 0; + subIndex = 0; + item1Index = 0; + items.clear(); + itemsCount = 0; + flags = 0; +} + bool MctlCompoundArray::load(MfcArchive &file) { debug(5, "MctlCompoundArray::load()"); @@ -820,9 +846,7 @@ void MovGraph2::buildMovInfo1SubItems(MovInfo1 *movinfo, Common::Array<MovGraphL } MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { - MovInfo1 movinfo; - - memcpy(&movinfo, movInfo, sizeof(movinfo)); + MovInfo1 movinfo(movInfo); int curX = movInfo->pt1.x; int curY = movInfo->pt1.y; @@ -1141,7 +1165,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int if (minPath < 0.0 || ((linkInfoSource.node != linkInfoDest.node || !linkInfoSource.node) && !tempLinkList.size())) return 0; - memset(&movInfo1, 0, sizeof(movInfo1)); + movInfo1.clear(); movInfo1.subIndex = idxsub; movInfo1.pt1.x = obj->_ox; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 029b25bb19..a4d68e17fb 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -372,6 +372,10 @@ struct MovInfo1 { Common::Array<MovInfo1Sub *> items; int itemsCount; int flags; + + MovInfo1() { clear(); } + MovInfo1(MovInfo1 *src); + void clear(); }; struct MovGraph2Item { // 744 |