ladybird/Ports/Super-Mario/patches/0005-Remove-global-static-initializers.patch

56 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Gunnar Beutner <gbeutner@serenityos.org>
Date: Thu, 29 Apr 2021 07:36:37 +0200
Subject: [PATCH] Remove global static initializers
---
src/CFG.cpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/CFG.cpp b/src/CFG.cpp
index 90595a5..20dd6ea 100644
--- a/src/CFG.cpp
+++ b/src/CFG.cpp
@@ -13,11 +13,11 @@ CCFG::~CCFG(void) {
int CCFG::GAME_HEIGHT = 448;
int CCFG::GAME_WIDTH = 800;
-Text* CCFG::oText = new Text();
-CIMG* CCFG::tSMBLOGO = new CIMG();
+Text* CCFG::oText = NULL;
+CIMG* CCFG::tSMBLOGO = NULL;
-MenuManager* CCFG::oMM = new MenuManager();
-Music* CCFG::oMusic = new Music();
+MenuManager* CCFG::oMM = NULL;
+Music* CCFG::oMusic = NULL;
bool CCFG::keySpace = false;
int CCFG::keyIDA = 0;
@@ -29,18 +29,26 @@ int CCFG::keyIDShift = 0;
bool CCFG::canMoveBackward = true;
Text* CCFG::getText() {
+ if (!oText)
+ oText = new Text();
return oText;
}
MenuManager* CCFG::getMM() {
+ if (!oMM)
+ oMM = new MenuManager();
return oMM;
}
Music* CCFG::getMusic() {
+ if (!oMusic)
+ oMusic = new Music();
return oMusic;
}
CIMG* CCFG::getSMBLOGO() {
+ if (!tSMBLOGO)
+ tSMBLOGO = new CIMG();
return tSMBLOGO;
}