[Scummvm-git-logs] scummvm master -> 6e68d88e95d0ff01d63b16fd25de53190966000e

AndywinXp noreply at scummvm.org
Mon Sep 23 07:51:20 UTC 2024


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

Summary:
1b3f506d1e SCUMM: BASKETBALL: Fix non-explicit integer division assigned to float
26f85ccaae SCUMM: BASKETBALL: Fix copy-instead-of-move Coverity issues
6e68d88e95 SCUMM: BASKETBALL: Fix memory leak


Commit: 1b3f506d1e4ab7dc3fffa6574b97683332b42095
    https://github.com/scummvm/scummvm/commit/1b3f506d1e4ab7dc3fffa6574b97683332b42095
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-09-23T09:51:12+02:00

Commit Message:
SCUMM: BASKETBALL: Fix non-explicit integer division assigned to float

Coverity issue

Changed paths:
    engines/scumm/he/basketball/ai.cpp


diff --git a/engines/scumm/he/basketball/ai.cpp b/engines/scumm/he/basketball/ai.cpp
index 120ac5de60d..ab1352d0500 100644
--- a/engines/scumm/he/basketball/ai.cpp
+++ b/engines/scumm/he/basketball/ai.cpp
@@ -176,8 +176,9 @@ int LogicHEBasketball::u32_userGetOpenSpot(int whichPlayer, U32FltVector2D upper
 	int rectWidth = fabs(upperLeft.x - lowerRight.x);
 	int rectHeight = fabs(upperLeft.y - lowerRight.y);
 
-	float xMesh = rectWidth / (xGranularity + 1);
-	float yMesh = rectHeight / (yGranularity + 1);
+	// Integer operation cast to float, this is intended!
+	float xMesh = (float)(rectWidth / (xGranularity + 1));
+	float yMesh = (float)(rectHeight / (yGranularity + 1));
 
 	float startX = upperLeft.x + xMesh / 2;
 	float startY = upperLeft.y + yMesh / 2;


Commit: 26f85ccaae457787435fd6edc8a5fb8838cf10b9
    https://github.com/scummvm/scummvm/commit/26f85ccaae457787435fd6edc8a5fb8838cf10b9
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-09-23T09:51:12+02:00

Commit Message:
SCUMM: BASKETBALL: Fix copy-instead-of-move Coverity issues

Changed paths:
    engines/scumm/he/basketball/collision/bball_collision.cpp
    engines/scumm/he/basketball/obstacle_avoidance.cpp


diff --git a/engines/scumm/he/basketball/collision/bball_collision.cpp b/engines/scumm/he/basketball/collision/bball_collision.cpp
index 30920e0e1f6..f054398863a 100644
--- a/engines/scumm/he/basketball/collision/bball_collision.cpp
+++ b/engines/scumm/he/basketball/collision/bball_collision.cpp
@@ -100,7 +100,7 @@ int LogicHEBasketball::u32_userInitCourt(int courtID) {
 
 		Common::String tmp2(tmp);
 
-		_vm->_basketball->_court->_objectList[i]._description = tmp2;
+		_vm->_basketball->_court->_objectList[i]._description = Common::move(tmp2);
 
 		free(tmp);
 
diff --git a/engines/scumm/he/basketball/obstacle_avoidance.cpp b/engines/scumm/he/basketball/obstacle_avoidance.cpp
index a45304488ea..3a15947ebd8 100644
--- a/engines/scumm/he/basketball/obstacle_avoidance.cpp
+++ b/engines/scumm/he/basketball/obstacle_avoidance.cpp
@@ -330,19 +330,19 @@ ERevDirection Basketball::getBestPath(const U32Circle &playerMarker, int playerI
 	if (leftPath && rightPath) {
 		*distance = MIN(leftDistance, rightDistance);
 		if (*distance == leftDistance) {
-			*wayPointQueue = leftWayPointQueue;
+			*wayPointQueue = Common::move(leftWayPointQueue);
 			return kCounterClockwise;
 		} else {
-			*wayPointQueue = rightWayPointQueue;
+			*wayPointQueue = Common::move(rightWayPointQueue);
 			return kClockwise;
 		}
 	} else if (leftPath && !rightPath) {
 		*distance = leftDistance;
-		*wayPointQueue = leftWayPointQueue;
+		*wayPointQueue = Common::move(leftWayPointQueue);
 		return kCounterClockwise;
 	} else if (!leftPath && rightPath) {
 		*distance = rightDistance;
-		*wayPointQueue = rightWayPointQueue;
+		*wayPointQueue = Common::move(rightWayPointQueue);
 		return kClockwise;
 	} else {
 		*distance = 0;


Commit: 6e68d88e95d0ff01d63b16fd25de53190966000e
    https://github.com/scummvm/scummvm/commit/6e68d88e95d0ff01d63b16fd25de53190966000e
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-09-23T09:51:12+02:00

Commit Message:
SCUMM: BASKETBALL: Fix memory leak

Changed paths:
    engines/scumm/he/basketball/basketball.cpp


diff --git a/engines/scumm/he/basketball/basketball.cpp b/engines/scumm/he/basketball/basketball.cpp
index 4671dd4e911..f2f7ebe0c29 100644
--- a/engines/scumm/he/basketball/basketball.cpp
+++ b/engines/scumm/he/basketball/basketball.cpp
@@ -31,7 +31,10 @@ Basketball::Basketball(ScummEngine_v100he *vm) {
 	_shields = new CCollisionShieldVector();
 }
 
-Basketball::~Basketball() {}
+Basketball::~Basketball() {
+	delete _court;
+	delete _shields;
+}
 
 int Basketball::u32FloatToInt(float input) {
 	int output = 0;




More information about the Scummvm-git-logs mailing list