[Scummvm-git-logs] scummvm master -> 21e69746d9d8aee534373bfb12d8356c740af5ea

digitall noreply at scummvm.org
Thu May 4 00:28:16 UTC 2023


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:
21e69746d9 WATCHMAKER: Further Fixes for GCC Compiler Warnings


Commit: 21e69746d9d8aee534373bfb12d8356c740af5ea
    https://github.com/scummvm/scummvm/commit/21e69746d9d8aee534373bfb12d8356c740af5ea
Author: D G Turner (digitall at scummvm.org)
Date: 2023-05-04T01:27:58+01:00

Commit Message:
WATCHMAKER: Further Fixes for GCC Compiler Warnings

Changed paths:
    engines/watchmaker/3d/render/render.cpp
    engines/watchmaker/fonts.cpp
    engines/watchmaker/game.cpp
    engines/watchmaker/ll/ll_mouse.cpp
    engines/watchmaker/ll/ll_regen.cpp
    engines/watchmaker/ll/ll_util.cpp
    engines/watchmaker/saveload.cpp
    engines/watchmaker/t2d/expr.cpp


diff --git a/engines/watchmaker/3d/render/render.cpp b/engines/watchmaker/3d/render/render.cpp
index f9b7a026805..be40f288429 100644
--- a/engines/watchmaker/3d/render/render.cpp
+++ b/engines/watchmaker/3d/render/render.cpp
@@ -48,8 +48,8 @@ unsigned int NumBatchBlocksSky = 0;
  *              Comparazione per BB
  * --------------------------------------------------*/
 int cmpbb(const void *a, const void *b) {
-	gBatchBlock *v1 = (gBatchBlock *)a;
-	gBatchBlock *v2 = (gBatchBlock *)b;
+	const gBatchBlock *v1 = (const gBatchBlock *)a;
+	const gBatchBlock *v2 = (const gBatchBlock *)b;
 
 	if (v1->Texture2 < v2->Texture2) return -1;
 	else if (v1->Texture2 > v2->Texture2) return 1;
diff --git a/engines/watchmaker/fonts.cpp b/engines/watchmaker/fonts.cpp
index 6095db428bb..8866f979669 100644
--- a/engines/watchmaker/fonts.cpp
+++ b/engines/watchmaker/fonts.cpp
@@ -33,9 +33,12 @@ Fonts::~Fonts() {
 
 uint16 *Fonts::setupFontTable(Common::SeekableReadStream &stream) {
 	uint32 dim = stream.size();
+	// FIXME: This looks slightly wrong. Should this be:
+	// uint16 *tab = new uint16[dim / sizeof(uint16)] {};
+	// to match the loop iteration?
 	uint16 *tab = new uint16[dim] {};
 
-	for (int i = 0; i < dim / sizeof(uint16); i++) {
+	for (uint32 i = 0; i < dim / sizeof(uint16); i++) {
 		tab[i] = stream.readUint16LE();
 	}
 
@@ -53,7 +56,7 @@ void Fonts::loadFont(WGame &game, struct SFont *f, const Common::String &n) {
 	}
 
 	Common::String basename = n.substr(0, n.findLastOf('.'));
-	for (char a = 0; a < MAX_FONT_COLORS; a++) {
+	for (uint a = 0; a < MAX_FONT_COLORS; a++) {
 		Common::String tgaName = constructPath(game.workDirs._miscDir, basename + (a + '0')) + ".tga";
 		if ((f->color[a] = rLoadBitmapImage(game, tgaName.c_str(), rBITMAPSURFACE | rSURFACEFLIP)) <= 0) {
 			DebugLogFile("Failed to load Font2. Quitting ...");
diff --git a/engines/watchmaker/game.cpp b/engines/watchmaker/game.cpp
index 0eb282b36f6..235c73501a3 100644
--- a/engines/watchmaker/game.cpp
+++ b/engines/watchmaker/game.cpp
@@ -587,7 +587,7 @@ void WGame::LoadMisc() {
 	//TrecLogo = LoadDDBitmap( "TrecLogo.tga", rSURFACESTRETCH );
 
 	for (i = 1; i < 85; i++) {
-		snprintf(str, 20, "I%0#3d.tga", i);
+		snprintf(str, 20, "I%03d.tga", i);
 		IconsPics[i] = LoadDDBitmap(*this, str, rSURFACESTRETCH);
 	}
 
diff --git a/engines/watchmaker/ll/ll_mouse.cpp b/engines/watchmaker/ll/ll_mouse.cpp
index 98322a46cb2..3c7bba07c4f 100644
--- a/engines/watchmaker/ll/ll_mouse.cpp
+++ b/engines/watchmaker/ll/ll_mouse.cpp
@@ -133,9 +133,9 @@ void ProcessMouse(WGame &game) {
 	}
 
 	auto windowInfo = game._renderer->getScreenInfos();
-	if (mPosx > windowInfo.width) mPosx = windowInfo.width - 1;
+	if (mPosx > (int32)windowInfo.width) mPosx = windowInfo.width - 1;
 	else if (mPosx <= 0) mPosx = 1;
-	if (mPosy > windowInfo.height) mPosy = windowInfo.height - 1;
+	if (mPosy > (int32)windowInfo.height) mPosy = windowInfo.height - 1;
 	else if (mPosy <= 0) mPosy = 1;
 
 	MoveHeadAngles(diffx, diffy);
diff --git a/engines/watchmaker/ll/ll_regen.cpp b/engines/watchmaker/ll/ll_regen.cpp
index a37d72be465..206e0bf7bb8 100644
--- a/engines/watchmaker/ll/ll_regen.cpp
+++ b/engines/watchmaker/ll/ll_regen.cpp
@@ -215,8 +215,8 @@ void Regen(WGame &game) {
 	auto windowInfo = game._renderer->getScreenInfos();
 	if (ext.x1 < 0) ext.x1 = 0;
 	if (ext.y1 < 0) ext.y1 = 0;
-	if (ext.x2 > windowInfo.width) ext.x2 = windowInfo.width;
-	if (ext.y2 > windowInfo.height) ext.y2 = windowInfo.height;
+	if (ext.x2 > (int32)windowInfo.width) ext.x2 = windowInfo.width;
+	if (ext.y2 > (int32)windowInfo.height) ext.y2 = windowInfo.height;
 #ifdef DEBUG_REGEN
 	DebugFile("Aggiorna video %d,%d %d,%d", ext.x1, ext.y1, ext.x2 - ext.x1, ext.y2 - ext.y1);
 //	DebugLogWindow( "Aggiorna video %d,%d %d,%d", ext.x1, ext.y1, ext.x2-ext.x1, ext.y2-ext.y1 );
diff --git a/engines/watchmaker/ll/ll_util.cpp b/engines/watchmaker/ll/ll_util.cpp
index 0b01592b780..381e3791144 100644
--- a/engines/watchmaker/ll/ll_util.cpp
+++ b/engines/watchmaker/ll/ll_util.cpp
@@ -311,8 +311,10 @@ void UpdateRoomVisibility(WGame &game) {
 	}
 
 //	Aggiunge room attuale
-	if (cr = (uint8)getRoomFromStr(init, t3dCurRoom->name))
+	cr = (uint8)getRoomFromStr(init, t3dCurRoom->name);
+	if (!cr) {
 		init.Room[cr].flags |= ROOM_VISIBLE;
+	}
 
 	if (bShowRoomDescriptions)
 		UpdateRoomInfo(game);
@@ -351,13 +353,19 @@ void UpdateRoomVisibility(WGame &game) {
 		if (!(pr = t3dCurRoom->MeshTable[i].PortalList) || (t3dCurRoom->MeshTable[i].Flags & T3D_MESH_NOPORTALCHECK))
 			continue;
 
-		if (cr = (uint8)getRoomFromStr(init, pr->name))
+		cr = (uint8)getRoomFromStr(init, pr->name);
+		if (!cr) {
 			init.Room[cr].flags |= ROOM_VISIBLE;
+		}
 
-		for (j = 0; j < pr->NumMeshes(); j++)
-			if ((pr->MeshTable[j].PortalList) && !(pr->MeshTable[j].Flags & T3D_MESH_NOPORTALCHECK))
-				if (cr = (uint8)getRoomFromStr(init, pr->MeshTable[j].PortalList->name))
+		for (j = 0; j < pr->NumMeshes(); j++) {
+			if ((pr->MeshTable[j].PortalList) && !(pr->MeshTable[j].Flags & T3D_MESH_NOPORTALCHECK)) {
+				cr = (uint8)getRoomFromStr(init, pr->MeshTable[j].PortalList->name);
+				if (!cr) {
 					init.Room[cr].flags |= ROOM_VISIBLE;
+				}
+			}
+		}
 	}
 
 //	Accende le animazioni di backgorund delle stanze che si vedono
diff --git a/engines/watchmaker/saveload.cpp b/engines/watchmaker/saveload.cpp
index e87d2c33c7f..39d58d97b3f 100644
--- a/engines/watchmaker/saveload.cpp
+++ b/engines/watchmaker/saveload.cpp
@@ -373,7 +373,7 @@ bool DataLoad(WGame &game, const Common::String &FileName, uint8 slot) {
 	if (!FileName.empty())
 		strcpy(str, FileName.c_str());
 	else
-		sprintf(str, "%sWm%#02d.sav", game.workDirs._savesDir.c_str(), slot);
+		sprintf(str, "%sWm%02d.sav", game.workDirs._savesDir.c_str(), slot);
 
 	auto stream = openFile(FileName);
 	if (!stream) {
diff --git a/engines/watchmaker/t2d/expr.cpp b/engines/watchmaker/t2d/expr.cpp
index 995b6eba04a..ccbf677494a 100644
--- a/engines/watchmaker/t2d/expr.cpp
+++ b/engines/watchmaker/t2d/expr.cpp
@@ -271,7 +271,7 @@ bool SilbRecon(char *Text, int tp, int LastVis, int NewSilb, int *CurrentSilb) {
 			if ((i != 0) && ((tp == TextLen) || ((tolower(Text[tp]) < 'a') || (tolower(Text[tp]) > 'z')))) Equal = TRUE;
 			break;
 
-		case 0xA3: // '£' // TODO: Create a proper constant for the Pound symbol.
+		case (char)0xA3: // '£' // TODO: Create a proper constant for the Pound symbol.
 			if ((i == 0) && (tp > 0) && (Vocale(Text[tp - 1]))) Equal = TRUE;
 			if ((i != 0) && (Vocale(Text[tp]))) {
 				Equal = TRUE;




More information about the Scummvm-git-logs mailing list