Browse Source

Fix physics meter value persisting after love.event.quit("restart").

Fixes #1685
Alex Szpakowski 4 years ago
parent
commit
977c690fa9
3 changed files with 14 additions and 0 deletions
  1. 1 0
      changes.txt
  2. 10 0
      src/modules/physics/box2d/Physics.cpp
  3. 3 0
      src/modules/physics/box2d/Physics.h

+ 1 - 0
changes.txt

@@ -18,6 +18,7 @@ Released: N/A
 * Fixed fused macOS apps opening other love games when drag-and-drop is used (if the fused app hasn't already removed .love files from recognized document types).
 * Fixed fused macOS apps opening other love games when drag-and-drop is used (if the fused app hasn't already removed .love files from recognized document types).
 * Fixed File:isEOF when called on a dropped file.
 * Fixed File:isEOF when called on a dropped file.
 * Fixed support for > 2GB dropped files on desktops.
 * Fixed support for > 2GB dropped files on desktops.
+* Fixed love.physics meter scale value persisting after love.event.quit("restart").
 * Fixed audio to resume properly after interruption on iOS.
 * Fixed audio to resume properly after interruption on iOS.
 * Fixed initial window creation to set the window's title during creation instead of after.
 * Fixed initial window creation to set the window's title during creation instead of after.
 * Fixed the window's screen position when exiting fullscreen via love.window.setFullscreen.
 * Fixed the window's screen position when exiting fullscreen via love.window.setFullscreen.

+ 10 - 0
src/modules/physics/box2d/Physics.cpp

@@ -31,8 +31,18 @@ namespace physics
 namespace box2d
 namespace box2d
 {
 {
 
 
+// TODO: Make this not static.
 float Physics::meter = Physics::DEFAULT_METER;
 float Physics::meter = Physics::DEFAULT_METER;
 
 
+Physics::Physics()
+{
+	meter = DEFAULT_METER;
+}
+
+Physics::~Physics()
+{
+}
+
 const char *Physics::getName() const
 const char *Physics::getName() const
 {
 {
 	return "love.physics.box2d";
 	return "love.physics.box2d";

+ 3 - 0
src/modules/physics/box2d/Physics.h

@@ -61,6 +61,9 @@ public:
 	 **/
 	 **/
 	static const int DEFAULT_METER = 30;
 	static const int DEFAULT_METER = 30;
 
 
+	Physics();
+	virtual ~Physics();
+
 	// Implements Module.
 	// Implements Module.
 	const char *getName() const;
 	const char *getName() const;
 	virtual ModuleType getModuleType() const { return M_PHYSICS; }
 	virtual ModuleType getModuleType() const { return M_PHYSICS; }