aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe
diff options
context:
space:
mode:
authorTorbjörn Andersson2019-01-05 20:12:42 +0100
committerFilippos Karapetis2019-07-14 14:58:19 +0300
commit4eef7a42e3f45a18a57674898f5fb5409f6daf5d (patch)
tree298ef17606a4aa0747b32c49bd6a28c7e7b9a32c /engines/fullpipe
parentb5b136b1770dd3ed4b750b9df9c10881dded1aba (diff)
downloadscummvm-rg350-4eef7a42e3f45a18a57674898f5fb5409f6daf5d.tar.gz
scummvm-rg350-4eef7a42e3f45a18a57674898f5fb5409f6daf5d.tar.bz2
scummvm-rg350-4eef7a42e3f45a18a57674898f5fb5409f6daf5d.zip
FULLPIPE: Silence GCC memset() warnings
Recent GCC versions complain if you memset() a class or struct that contain non-POD data types. Get around that by either initializing the object when created, or by adding a reset() method.
Diffstat (limited to 'engines/fullpipe')
-rw-r--r--engines/fullpipe/anihandler.cpp2
-rw-r--r--engines/fullpipe/anihandler.h25
-rw-r--r--engines/fullpipe/motion.cpp4
-rw-r--r--engines/fullpipe/scenes/scene04.cpp2
4 files changed, 28 insertions, 5 deletions
diff --git a/engines/fullpipe/anihandler.cpp b/engines/fullpipe/anihandler.cpp
index 4ae870bb93..05cde7567d 100644
--- a/engines/fullpipe/anihandler.cpp
+++ b/engines/fullpipe/anihandler.cpp
@@ -528,7 +528,7 @@ int AniHandler::seekWay(int idx, int st1idx, int st2idx, bool flip, bool flop) {
debugC(2, kDebugPathfinding, "AniHandler::seekWay(%d, %d, %d, %d, %d)", idx, st1idx, st2idx, flip, flop);
if (st1idx == st2idx) {
- memset(&item.subItems[subIdx], 0, sizeof(item.subItems[subIdx]));
+ item.subItems[subIdx].reset();
return 0;
}
diff --git a/engines/fullpipe/anihandler.h b/engines/fullpipe/anihandler.h
index f73d755aa9..ed4e382869 100644
--- a/engines/fullpipe/anihandler.h
+++ b/engines/fullpipe/anihandler.h
@@ -38,6 +38,15 @@ struct MGMSubItem {
int y;
MGMSubItem();
+
+ void reset() {
+ movement = nullptr;
+ staticsIndex = 0;
+ field_8 = 0;
+ field_C = 0;
+ x = 0;
+ y = 0;
+ }
};
struct MGMItem {
@@ -63,7 +72,21 @@ struct MakeQueueStruct {
int y2;
int flags;
- MakeQueueStruct() { memset(this, 0, sizeof(MakeQueueStruct)); }
+ MakeQueueStruct() { reset(); }
+
+ void reset() {
+ ani = nullptr;
+ staticsId1 = 0;
+ staticsId2 = 0;
+ movementId = 0;
+ field_10 = 0;
+ x1 = 0;
+ y1 = 0;
+ field_1C = 0;
+ x2 = 0;
+ y2 = 0;
+ flags = 0;
+ }
};
class AniHandler : public CObject {
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index d907c3d65c..c667ac2aa5 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -1230,7 +1230,7 @@ MessageQueue *MovGraph::makeWholeQueue(StaticANIObject *ani, MovArr *movarr, int
MakeQueueStruct mkQueue;
- memset(&mkQueue, 0, sizeof(mkQueue));
+ mkQueue.reset();
mkQueue.ani = ani;
mkQueue.staticsId2 = id2;
mkQueue.staticsId1 = id1;
@@ -1996,7 +1996,7 @@ MessageQueue *MctlGraph::makeWholeQueue(MctlMQ &mctlMQ) {
} else {
MakeQueueStruct mkQueue;
- memset(&mkQueue, 0, sizeof(mkQueue));
+ mkQueue.reset();
mkQueue.ani = _items2[mctlMQ.index]._obj;
mkQueue.staticsId2 = mg2i->_mov->_staticsObj2->_staticsId;
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index 45ada3ea6f..59adf37c66 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -645,7 +645,7 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
MessageQueue *mq1 = aniHandler.makeRunQueue(&mkQueue);
- memset(&mkQueue, 0, sizeof(mkQueue));
+ mkQueue.reset();
mkQueue.ani = ani;
mkQueue.staticsId1 = ST_KZW_JUMPOUT;
mkQueue.staticsId2 = ST_KZW_SIT;