summaryrefslogtreecommitdiff
path: root/src/f/f_list.cpp
diff options
context:
space:
mode:
authorelijah-thomas774 <elijahthomas774@gmail.com>2024-03-17 17:40:00 -0400
committerelijah-thomas774 <elijahthomas774@gmail.com>2024-03-17 17:40:00 -0400
commit606cc15eeda81fe26207ccab28e84a1ef40ec3fd (patch)
tree69576d8441f2f0d1a70e8833ccc7a984784e4ebb /src/f/f_list.cpp
parentc2a4909bd2a9a23d73a65f6840e8c886658cef74 (diff)
some fManager, fBase, mHeap, f - lists and tree stuff
Diffstat (limited to 'src/f/f_list.cpp')
-rw-r--r--src/f/f_list.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/f/f_list.cpp b/src/f/f_list.cpp
new file mode 100644
index 00000000..6201b7f5
--- /dev/null
+++ b/src/f/f_list.cpp
@@ -0,0 +1,87 @@
+#include <f/f_base.h>
+#include <f/f_list_mg.h>
+#include <f/f_list_mg_ptmf.h>
+
+/* 802e2680 */
+void fLiMgPTMF_c::addNode(fLiNdPrio_c *add) {
+ fLiNdPrio_c *node = getFirst();
+
+ if (add == nullptr) {
+ return;
+ }
+
+ if (node == nullptr) {
+ append(add);
+ return;
+ }
+
+ if (node->getOrder() > add->getOrder()) {
+ insertAfter(add, nullptr);
+ return;
+ }
+
+ while (node->getNext() != nullptr && node->getNext()->getOrder() <= add->getOrder()) {
+ node = node->getNext();
+ }
+ insertAfter(add, node);
+}
+
+/* 802e26e0 */
+bool fLiMgPTMF_c::walkPack() {
+ if (mpProcFunc == nullptr) {
+ return true;
+ }
+
+ fLiNdBa_c *node = getFirst();
+ while (node != nullptr) {
+ fLiNdBa_c *next_node = node->getNext();
+ (node->p_owner->*mpProcFunc)();
+ node = next_node;
+ }
+
+ return true;
+}
+
+/* 802e2760 */
+const fLiNdBa_c *fLiMgBa_c::searchNodeByID(fBaseID_e id) const {
+ fLiNdBa_c *node = getFirst();
+ while (node != nullptr) {
+ if (node->p_owner->unique_ID == id) {
+ return node;
+ }
+ node = node->getNext();
+ }
+ return nullptr;
+}
+
+/* 802e2790 */
+const fLiNdBa_c *fLiMgBa_c::searchNodeByProfName(ProfileName name, fLiNdBa_c *start) const {
+ fLiNdBa_c *node = start != nullptr ? start->getNext() : getFirst();
+ while (node != nullptr) {
+ if (node->p_owner->profile_name == name) {
+ return node;
+ }
+ node = node->getNext();
+ }
+ return nullptr;
+}
+
+/* 802e27d0 */
+void fLiNdBa_c::link(fBase_c *link) {
+ if (p_owner != nullptr) {
+ unlink();
+ }
+
+ if (link != nullptr) {
+ p_owner = link;
+ link->actor_list.append(this);
+ }
+}
+
+/* 802e2830 */
+void fLiNdBa_c::unlink() {
+ if (p_owner != nullptr) {
+ reinterpret_cast<fBase_c *>(p_owner)->actor_list.remove(this);
+ p_owner = nullptr;
+ }
+}