From 7953fe742525a108fbb21591db1ad223fba47f21 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 2 Oct 2023 17:00:50 +1100 Subject: [PATCH] - Delete all players upon engine shutdown. --- source/core/coreplayer.h | 1 + source/core/gamecontrol.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/core/coreplayer.h b/source/core/coreplayer.h index e31a9fefa..c4ede410f 100644 --- a/source/core/coreplayer.h +++ b/source/core/coreplayer.h @@ -10,6 +10,7 @@ struct CorePlayer PlayerAngles Angles; DCoreActor* actor; + virtual ~CorePlayer() { if (actor) actor->Destroy(); }; virtual DCoreActor* GetActor() = 0; }; diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 6dd69f69d..be66b38f5 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -84,7 +84,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "hw_material.h" #include "tiletexture.h" #include "tilesetbuilder.h" -#include "gameinput.h" +#include "coreplayer.h" #include "buildtiles.h" @@ -632,7 +632,11 @@ int GameMain() r = -1; } //DeleteScreenJob(); - if (gi) gi->FreeLevelData(); + if (gi) + { + gi->FreeLevelData(); + for (int i = 0; i < MAXPLAYERS; i++) delete PlayerArray[i]; + } DestroyAltHUD(); DeinitMenus(); if (StatusBar) StatusBar->Destroy();