From 977c690fa97760ed195d2e32570a7ac8eb19318b Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 11 Apr 2021 19:53:16 -0300 Subject: [PATCH] Fix physics meter value persisting after love.event.quit("restart"). Fixes #1685 --- changes.txt | 1 + src/modules/physics/box2d/Physics.cpp | 10 ++++++++++ src/modules/physics/box2d/Physics.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/changes.txt b/changes.txt index 6540115af..256a108b7 100644 --- a/changes.txt +++ b/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 File:isEOF when called on a dropped file. * 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 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. diff --git a/src/modules/physics/box2d/Physics.cpp b/src/modules/physics/box2d/Physics.cpp index 014ef87e6..1ae5e87d3 100644 --- a/src/modules/physics/box2d/Physics.cpp +++ b/src/modules/physics/box2d/Physics.cpp @@ -31,8 +31,18 @@ namespace physics namespace box2d { +// TODO: Make this not static. float Physics::meter = Physics::DEFAULT_METER; +Physics::Physics() +{ + meter = DEFAULT_METER; +} + +Physics::~Physics() +{ +} + const char *Physics::getName() const { return "love.physics.box2d"; diff --git a/src/modules/physics/box2d/Physics.h b/src/modules/physics/box2d/Physics.h index f84f7f398..832322913 100644 --- a/src/modules/physics/box2d/Physics.h +++ b/src/modules/physics/box2d/Physics.h @@ -61,6 +61,9 @@ public: **/ static const int DEFAULT_METER = 30; + Physics(); + virtual ~Physics(); + // Implements Module. const char *getName() const; virtual ModuleType getModuleType() const { return M_PHYSICS; }