[Scummvm-git-logs] scummvm master -> d87419f0a45cf685e0429142973318a599bc25da

digitall 547637+digitall at users.noreply.github.com
Mon Mar 22 18:51:31 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d87419f0a4 QUEEN: Fix Memset on Non-Trivial Structure GCC Compiler Warnings


Commit: d87419f0a45cf685e0429142973318a599bc25da
    https://github.com/scummvm/scummvm/commit/d87419f0a45cf685e0429142973318a599bc25da
Author: D G Turner (digitall at scummvm.org)
Date: 2021-03-22T18:50:27Z

Commit Message:
QUEEN: Fix Memset on Non-Trivial Structure GCC Compiler Warnings

Changed paths:
    engines/queen/display.cpp
    engines/queen/display.h
    engines/queen/graphics.cpp
    engines/queen/graphics.h


diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp
index b3763ac83a..1214f6eb9d 100644
--- a/engines/queen/display.cpp
+++ b/engines/queen/display.cpp
@@ -73,9 +73,11 @@ Display::Display(QueenEngine *vm, OSystem *system)
 	_imageExt = (_vm->resource()->getPlatform() == Common::kPlatformAmiga) ? "LBM" : "PCX";
 
 	_curTextColor = 0;
-	memset(_texts, 0, sizeof(_texts));
+	for (uint i = 0; i < ARRAYSIZE(_texts); i++) {
+		_texts[i].clear();
+	}
 
-	memset(&_dynalum, 0, sizeof(_dynalum));
+	_dynalum.clear();
 
 	setupInkColors();
 }
diff --git a/engines/queen/display.h b/engines/queen/display.h
index 7261d05b07..fe5d601752 100644
--- a/engines/queen/display.h
+++ b/engines/queen/display.h
@@ -212,6 +212,15 @@ private:
 		int8 *lumBuf;
 		uint32 lumSize;
 		uint8 prevColMask;
+
+		void clear() {
+			valid = false;
+			mskBuf = nullptr;
+			mskSize = 0;
+			lumBuf = nullptr;
+			lumSize = 0;
+			prevColMask = 0;
+		}
 	};
 
 	struct TextSlot {
@@ -219,6 +228,13 @@ private:
 		uint8 color;
 		Common::String text;
 		bool outlined;
+
+		void clear() {
+			x = 0;
+			color = 0;
+			text = "";
+			outlined = false;
+		}
 	};
 
 	uint8 *_screenBuf;
diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp
index 8b1242d595..2eda781833 100644
--- a/engines/queen/graphics.cpp
+++ b/engines/queen/graphics.cpp
@@ -175,6 +175,37 @@ void BobSlot::scaleWalkSpeed(uint16 ms) {
 	}
 }
 
+void BobSlot::clear() {
+	active = false;
+	x = 0;
+	y = 0;
+	box = Box();
+	xflip = false;
+	scale = 0;
+	frameNum = 0;
+	frameDir = 0;
+
+	animating = false;
+	anim.speed = 0;
+	anim.speedBak = 0;
+	anim.string.buffer = nullptr;
+	anim.string.curPos = nullptr;
+	anim.normal.rebound = false;
+	anim.normal.firstFrame = 0;
+	anim.normal.lastFrame = 0;
+
+	moving = false;
+	speed = 0;
+	xmajor = false;
+	xdir = 0;
+	ydir = 0;
+	endx = 0;
+	endy = 0;
+	dx = 0;
+	dy = 0;
+	total = 0;
+}
+
 void BobSlot::clear(const Box *defaultBox) {
 	active = false;
 	xflip = false;
@@ -203,8 +234,12 @@ Graphics::Graphics(QueenEngine *vm)
 	_defaultBox(-1, -1, -1, -1),
 	_gameScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, ROOM_ZONE_HEIGHT - 1),
 	_fullScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, GAME_SCREEN_HEIGHT - 1) {
-	memset(_bobs, 0, sizeof(_bobs));
-	memset(_sortedBobs, 0, sizeof(_sortedBobs));
+	for (uint i = 0; i < ARRAYSIZE(_bobs); i++) {
+		_bobs[i].clear();
+	}
+	for (uint i = 0; i < ARRAYSIZE(_sortedBobs); i++) {
+		_sortedBobs[i] = nullptr;
+	}
 	_sortedBobsCount = 0;
 	_shrinkBuffer.data = new uint8[ BOB_SHRINK_BUF_SIZE ];
 }
diff --git a/engines/queen/graphics.h b/engines/queen/graphics.h
index 2035b170d3..243ef94766 100644
--- a/engines/queen/graphics.h
+++ b/engines/queen/graphics.h
@@ -83,6 +83,7 @@ struct BobSlot {
 
 	void scaleWalkSpeed(uint16 ms);
 
+	void clear();
 	void clear(const Box *defaultBox);
 };
 




More information about the Scummvm-git-logs mailing list