summaryrefslogtreecommitdiff
path: root/src/engine/GarbageCollector.cpp
diff options
context:
space:
mode:
authorMegaMech <inkstudios1@hotmail.com>2024-12-28 00:25:41 -0700
committerMegaMech <inkstudios1@hotmail.com>2024-12-28 00:25:41 -0700
commit830922541296d049cd5c0689c1f610586f56bc75 (patch)
treeef52c54c9e435544deea887062032f7a99e4126d /src/engine/GarbageCollector.cpp
parent135b51ea719c6107663d9f54cc3e8cb7404dbda3 (diff)
Reimpl Lakitu
Diffstat (limited to 'src/engine/GarbageCollector.cpp')
-rw-r--r--src/engine/GarbageCollector.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/engine/GarbageCollector.cpp b/src/engine/GarbageCollector.cpp
new file mode 100644
index 000000000..926620fe1
--- /dev/null
+++ b/src/engine/GarbageCollector.cpp
@@ -0,0 +1,31 @@
+#include "GarbageCollector.h"
+#include "World.h"
+
+void RunGarbageCollector() {
+ //CleanActors();
+ CleanObjects();
+}
+
+void CleanActors() {
+ // for (auto actor = gWorldInstance.Actors.begin(); actor != gWorldInstance.Actors.end();) {
+ // OObject* act = *actor; // Get a mutable copy
+ // if (act->PendingDestroy) {
+ // delete act;
+ // actor = gWorldInstance.Objects.erase(actor); // Remove from container
+ // continue;
+ // }
+ // actor++;
+ // }
+}
+
+void CleanObjects() {
+ for (auto object = gWorldInstance.Objects.begin(); object != gWorldInstance.Objects.end();) {
+ OObject* obj = *object; // Get a mutable copy
+ if (obj->PendingDestroy) {
+ delete obj;
+ object = gWorldInstance.Objects.erase(object); // Remove from container
+ continue;
+ }
+ object++;
+ }
+} \ No newline at end of file