[Scummvm-git-logs] scummvm master -> 44ece8cfd0e11e997050d4d712cd1bf9aa994b38

bluegr noreply at scummvm.org
Sat Oct 24 19:45:39 UTC 2026


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

Summary:
56f0d0dbf7 NANCY: BOX2D: do nost cast away constness
a1e12cb5ed NANCY: BOX2D: cover all enum entries in switch statement
44ece8cfd0 NANCY: BOX2D: make some constructors constexpr


Commit: 56f0d0dbf7c982caec7e26dbcb60228ad6efc89f
    https://github.com/scummvm/scummvm/commit/56f0d0dbf7c982caec7e26dbcb60228ad6efc89f
Author: Michael Kuerbis (michael_kuerbis at web.de)
Date: 2026-10-24T22:45:33+03:00

Commit Message:
NANCY: BOX2D: do nost cast away constness

Changed paths:
    engines/nancy/box2d/Collision/b2Distance.cpp
    engines/nancy/box2d/Dynamics/Joints/b2Joint.cpp


diff --git a/engines/nancy/box2d/Collision/b2Distance.cpp b/engines/nancy/box2d/Collision/b2Distance.cpp
index 55132e451fd..aed924c30d4 100644
--- a/engines/nancy/box2d/Collision/b2Distance.cpp
+++ b/engines/nancy/box2d/Collision/b2Distance.cpp
@@ -355,22 +355,22 @@ float32 b2Distance(b2Vec2* x1, b2Vec2* x2,
 
 	if (type1 == e_circleShape && type2 == e_circleShape)
 	{
-		return DistanceCC(x1, x2, (b2CircleShape*)shape1, xf1, (b2CircleShape*)shape2, xf2);
+		return DistanceCC(x1, x2, (const b2CircleShape*)shape1, xf1, (const b2CircleShape*)shape2, xf2);
 	}
 	
 	if (type1 == e_polygonShape && type2 == e_circleShape)
 	{
-		return DistancePC(x1, x2, (b2PolygonShape*)shape1, xf1, (b2CircleShape*)shape2, xf2);
+		return DistancePC(x1, x2, (const b2PolygonShape*)shape1, xf1, (const b2CircleShape*)shape2, xf2);
 	}
 
 	if (type1 == e_circleShape && type2 == e_polygonShape)
 	{
-		return DistancePC(x2, x1, (b2PolygonShape*)shape2, xf2, (b2CircleShape*)shape1, xf1);
+		return DistancePC(x2, x1, (const b2PolygonShape*)shape2, xf2, (const b2CircleShape*)shape1, xf1);
 	}
 
 	if (type1 == e_polygonShape && type2 == e_polygonShape)
 	{
-		return DistanceGeneric(x1, x2, (b2PolygonShape*)shape1, xf1, (b2PolygonShape*)shape2, xf2);
+		return DistanceGeneric(x1, x2, (const b2PolygonShape*)shape1, xf1, (const b2PolygonShape*)shape2, xf2);
 	}
 
 	return 0.0f;
diff --git a/engines/nancy/box2d/Dynamics/Joints/b2Joint.cpp b/engines/nancy/box2d/Dynamics/Joints/b2Joint.cpp
index b9fbe2dee26..95e85c2a822 100644
--- a/engines/nancy/box2d/Dynamics/Joints/b2Joint.cpp
+++ b/engines/nancy/box2d/Dynamics/Joints/b2Joint.cpp
@@ -63,42 +63,42 @@ b2Joint* b2Joint::Create(const b2JointDef* def, b2BlockAllocator* allocator)
 	case e_distanceJoint:
 		{
 			void* mem = allocator->Allocate(sizeof(b2DistanceJoint));
-			joint = new (mem) b2DistanceJoint((b2DistanceJointDef*)def);
+			joint = new (mem) b2DistanceJoint((const b2DistanceJointDef*)def);
 		}
 		break;
 
 	case e_mouseJoint:
 		{
 			void* mem = allocator->Allocate(sizeof(b2MouseJoint));
-			joint = new (mem) b2MouseJoint((b2MouseJointDef*)def);
+			joint = new (mem) b2MouseJoint((const b2MouseJointDef*)def);
 		}
 		break;
 
 	case e_prismaticJoint:
 		{
 			void* mem = allocator->Allocate(sizeof(b2PrismaticJoint));
-			joint = new (mem) b2PrismaticJoint((b2PrismaticJointDef*)def);
+			joint = new (mem) b2PrismaticJoint((const b2PrismaticJointDef*)def);
 		}
 		break;
 
 	case e_revoluteJoint:
 		{
 			void* mem = allocator->Allocate(sizeof(b2RevoluteJoint));
-			joint = new (mem) b2RevoluteJoint((b2RevoluteJointDef*)def);
+			joint = new (mem) b2RevoluteJoint((const b2RevoluteJointDef*)def);
 		}
 		break;
 
 	case e_pulleyJoint:
 		{
 			void* mem = allocator->Allocate(sizeof(b2PulleyJoint));
-			joint = new (mem) b2PulleyJoint((b2PulleyJointDef*)def);
+			joint = new (mem) b2PulleyJoint((const b2PulleyJointDef*)def);
 		}
 		break;
 
 	case e_gearJoint:
 		{
 			void* mem = allocator->Allocate(sizeof(b2GearJoint));
-			joint = new (mem) b2GearJoint((b2GearJointDef*)def);
+			joint = new (mem) b2GearJoint((const b2GearJointDef*)def);
 		}
 		break;
 


Commit: a1e12cb5edb49b36761f19fecbab5c973228af1e
    https://github.com/scummvm/scummvm/commit/a1e12cb5edb49b36761f19fecbab5c973228af1e
Author: Michael Kuerbis (michael_kuerbis at web.de)
Date: 2026-10-24T22:45:33+03:00

Commit Message:
NANCY: BOX2D: cover all enum entries in switch statement

Changed paths:
    engines/nancy/box2d/Dynamics/b2World.cpp


diff --git a/engines/nancy/box2d/Dynamics/b2World.cpp b/engines/nancy/box2d/Dynamics/b2World.cpp
index 2a910f940db..4faf5c058ad 100644
--- a/engines/nancy/box2d/Dynamics/b2World.cpp
+++ b/engines/nancy/box2d/Dynamics/b2World.cpp
@@ -862,6 +862,11 @@ void b2World::DrawShape(b2Shape* shape, const b2XForm& xf, const b2Color& color,
 			}
 		}
 		break;
+	
+	case e_unknownShape:
+	case e_shapeTypeCount:
+		b2Assert(false);
+		break;
 	}
 }
 


Commit: 44ece8cfd0e11e997050d4d712cd1bf9aa994b38
    https://github.com/scummvm/scummvm/commit/44ece8cfd0e11e997050d4d712cd1bf9aa994b38
Author: Michael Kuerbis (michael_kuerbis at web.de)
Date: 2026-10-24T22:45:33+03:00

Commit Message:
NANCY: BOX2D: make some constructors constexpr

Changed paths:
    engines/nancy/box2d/Common/b2Math.h


diff --git a/engines/nancy/box2d/Common/b2Math.h b/engines/nancy/box2d/Common/b2Math.h
index c9ab1f37f7c..e7b8c9627cc 100644
--- a/engines/nancy/box2d/Common/b2Math.h
+++ b/engines/nancy/box2d/Common/b2Math.h
@@ -85,10 +85,10 @@ inline float32 b2Abs(float32 a)
 struct b2Vec2
 {
 	/// Default constructor does nothing (for performance).
-	b2Vec2() {}
+	constexpr b2Vec2() = default;
 
 	/// Construct using coordinates.
-	b2Vec2(float32 x, float32 y) : x(x), y(y) {}
+	constexpr b2Vec2(float32 x, float32 y) : x(x), y(y) {}
 
 	/// Set this vector to all zeros.
 	void SetZero() { x = 0.0f; y = 0.0f; }
@@ -151,27 +151,23 @@ struct b2Vec2
 		return b2IsValid(x) && b2IsValid(y);
 	}
 
-	float32 x, y;
+	float32 x = 0.0f, y = 0.0f;
 };
 
 /// A 2-by-2 matrix. Stored in column-major order.
 struct b2Mat22
 {
 	/// The default constructor does nothing (for performance).
-	b2Mat22() {}
+	constexpr b2Mat22() = default;
 
 	/// Construct this matrix using columns.
-	b2Mat22(const b2Vec2& c1, const b2Vec2& c2)
+	constexpr b2Mat22(const b2Vec2& c1, const b2Vec2& c2) : col1(c1), col2(c2)
 	{
-		col1 = c1;
-		col2 = c2;
 	}
 
 	/// Construct this matrix using scalars.
-	b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22)
+	constexpr b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22) : col1({a11, a21}), col2({a12, a22})
 	{
-		col1.x = a11; col1.y = a21;
-		col2.x = a12; col2.y = a22;
 	}
 
 	/// Construct this matrix using an angle. This matrix becomes
@@ -254,10 +250,10 @@ struct b2Mat22
 struct b2XForm
 {
 	/// The default constructor does nothing (for performance).
-	b2XForm() {}
+	constexpr b2XForm() = default;
 
 	/// Initialize using a position vector and a rotation matrix.
-	b2XForm(const b2Vec2& position, const b2Mat22& R) : position(position), R(R) {}
+	constexpr b2XForm(const b2Vec2& position, const b2Mat22& R) : position(position), R(R) {}
 
 	/// Set this to the identity transform.
 	void SetIdentity()




More information about the Scummvm-git-logs mailing list