diff options
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/World.cpp | 3 | ||||
| -rw-r--r-- | src/engine/World.h | 1 | ||||
| -rw-r--r-- | src/engine/editor/Editor.cpp | 19 | ||||
| -rw-r--r-- | src/engine/editor/Editor.h | 1 | ||||
| -rw-r--r-- | src/engine/editor/EditorMath.cpp | 4 |
5 files changed, 22 insertions, 6 deletions
diff --git a/src/engine/World.cpp b/src/engine/World.cpp index 8137b3801..6620a2815 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -22,6 +22,9 @@ extern "C" { } World::World() {} +World::~World() { + CM_CleanWorld(); +} Course* CurrentCourse; Cup* CurrentCup; diff --git a/src/engine/World.h b/src/engine/World.h index bc6845aae..91287b162 100644 --- a/src/engine/World.h +++ b/src/engine/World.h @@ -52,6 +52,7 @@ class World { public: explicit World(); + ~World(); void AddCourse(Course* course); diff --git a/src/engine/editor/Editor.cpp b/src/engine/editor/Editor.cpp index 446da7487..23a947a09 100644 --- a/src/engine/editor/Editor.cpp +++ b/src/engine/editor/Editor.cpp @@ -30,6 +30,11 @@ namespace Editor { Editor::Editor() { } + Editor::~Editor() { + ClearObjects(); + ClearMatrixPool(); + } + void Editor::Load() { printf("Editor: Loading Editor...\n"); eObjectPicker.Load(); @@ -58,10 +63,16 @@ namespace Editor { Ship::Coords mousePos = wnd->GetMousePos(); bool isMouseDown = wnd->GetMouseState(Ship::LUS_MOUSE_BTN_LEFT); - eGameObjects.erase( - std::remove_if(eGameObjects.begin(), eGameObjects.end(), - [](const auto& object) { return (*object->DespawnFlag) == object->DespawnValue; }), - eGameObjects.end()); + auto it = std::remove_if(eGameObjects.begin(), eGameObjects.end(), + [](auto& object) { + if (*object->DespawnFlag == object->DespawnValue) { + delete object; // Free the pointed-to memory + return true; // Remove the pointer from the vector + } + return false; + }); + + eGameObjects.erase(it, eGameObjects.end()); if (isMouseDown && !wasMouseDown) { // Mouse just pressed (Pressed state) diff --git a/src/engine/editor/Editor.h b/src/engine/editor/Editor.h index 759c59355..60e578b21 100644 --- a/src/engine/editor/Editor.h +++ b/src/engine/editor/Editor.h @@ -14,6 +14,7 @@ namespace Editor { class Editor { public: Editor(); + ~Editor(); ObjectPicker eObjectPicker; std::vector<GameObject*> eGameObjects; diff --git a/src/engine/editor/EditorMath.cpp b/src/engine/editor/EditorMath.cpp index 04a299563..f3833008b 100644 --- a/src/engine/editor/EditorMath.cpp +++ b/src/engine/editor/EditorMath.cpp @@ -352,8 +352,8 @@ bool IntersectRaySphere(const Ray& ray, const FVector& sphereCenter, float radiu // Transform a matrix to a matrix identity void Editor_MatrixIdentity(Mat4 mtx) { - register s32 i; - register s32 k; + s32 i; + s32 k; for (i = 0; i < 4; i++) { for (k = 0; k < 4; k++) { |
