BBVS: Fix Memset on Non-Trivial Structure GCC Compiler Warnings

This commit is contained in:
D G Turner 2021-03-21 22:35:12 +00:00
parent d74b2e09b3
commit 312770c972
3 changed files with 23 additions and 3 deletions

View File

@ -172,7 +172,27 @@ struct SceneObject {
int xIncr, yIncr;
int turnValue, turnCount, turnTicks;
Common::Point walkDestPt;
SceneObject() : sceneObjectDef(0), anim(0) {
SceneObject() {
clear();
}
void clear() {
x = 0;
y = 0;
sceneObjectDef = nullptr;
anim = nullptr;
animIndex = 0;
frameIndex = 0;
frameTicks = 0;
walkCount = 0;
xIncr = 0;
yIncr = 0;
turnValue = 0;
turnCount = 0;
turnTicks = 0;
walkDestPt.x = 0;
walkDestPt.y = 0;
}
};

View File

@ -109,8 +109,8 @@ void BbvsEngine::loadgame(const char *filename) {
g_engine->setTotalPlayTime(header.playTime * 1000);
memset(_sceneObjects, 0, sizeof(_sceneObjects));
for (int i = 0; i < kSceneObjectsCount; ++i) {
_sceneObjects[i].clear();
_sceneObjects[i].walkDestPt.x = -1;
_sceneObjects[i].walkDestPt.y = -1;
}

View File

@ -100,8 +100,8 @@ void BbvsEngine::initScene(bool sounds) {
memset(_backgroundSoundsActive, 0, sizeof(_backgroundSoundsActive));
memset(_sceneObjects, 0, sizeof(_sceneObjects));
for (int i = 0; i < kSceneObjectsCount; ++i) {
_sceneObjects[i].clear();
_sceneObjects[i].walkDestPt.x = -1;
_sceneObjects[i].walkDestPt.y = -1;
}