Merge pull request #6 from robojumper/c_list

c/c_list.cpp
This commit is contained in:
Elijah Thomas
2024-04-27 10:30:17 -04:00
committed by GitHub
4 changed files with 78 additions and 1 deletions
+3
View File
@@ -119,6 +119,9 @@ toBeSorted/unk_flag_stuff.cpp:
toBeSorted/bitwise_flag_helper.cpp:
.text start:0x800BF200 end:0x800BF264
c/c_list.cpp:
.text start:0x802E08C0 end:0x802E0A10
f/f_base.cpp:
.text start:0x802E12F0 end:0x802E2680
.ctors start:0x804DB8C0 end:0x804DB8C4
+1 -1
View File
@@ -17278,7 +17278,7 @@ fn_802E0710 = .text:0x802E0710; // type:function size:0xD8
fn_802E07F0 = .text:0x802E07F0; // type:function size:0x24
fn_802E0820 = .text:0x802E0820; // type:function size:0x34
fn_802E0860 = .text:0x802E0860; // type:function size:0x60
fn_802E08C0 = .text:0x802E08C0; // type:function size:0x40
insertAfter__9cListMg_cFP9cListNd_cP9cListNd_c = .text:0x802E08C0; // type:function size:0x40
remove__9cListMg_cFP9cListNd_c = .text:0x802E0900; // type:function size:0xAC
append__9cListMg_cFP9cListNd_c = .text:0x802E09B0; // type:function size:0x30
prepend__9cListMg_cFP9cListNd_c = .text:0x802E09E0; // type:function size:0x30
+1
View File
@@ -274,6 +274,7 @@ config.libs = [
Object(Matching, "toBeSorted/sceneflag_manager.cpp"),
Object(NonMatching, "toBeSorted/flag_space.cpp"),
Object(NonMatching, "toBeSorted/misc_flag_managers.cpp"),
Object(Matching, "c/c_list.cpp"),
Object(Matching, "d/d_base.cpp"),
Object(NonMatching, "d/d_heap.cpp"),
Object(NonMatching, "d/d_stage.cpp"),
+73
View File
@@ -0,0 +1,73 @@
#include <c/c_list.h>
bool cListMg_c::insertAfter(cListNd_c *node, cListNd_c *prevNode) {
if (prevNode == nullptr) {
return this->prepend(node);
}
if (node == nullptr) {
return;
}
node->mpNext = prevNode->mpNext;
node->mpPrev = prevNode;
prevNode->mpNext = node;
if (node->mpNext != nullptr) {
node->mpNext->mpPrev = node;
} else {
this->mpLast = node;
}
}
bool cListMg_c::remove(cListNd_c *node) {
if (node == nullptr) {
return;
}
if (node->mpPrev == nullptr && node->mpNext == nullptr) {
if (this->mpFirst == node && this->mpLast == node) {
this->mpFirst = nullptr;
this->mpLast = nullptr;
}
} else {
if (node->mpPrev != nullptr) {
node->mpPrev->mpNext = node->mpNext;
} else if (node == this->mpFirst) {
this->mpFirst = node->mpNext;
}
if (node->mpNext != nullptr) {
node->mpNext->mpPrev = node->mpPrev;
} else if (node == this->mpLast) {
this->mpLast = node->mpPrev;
}
node->mpPrev = nullptr;
node->mpNext = nullptr;
}
}
bool cListMg_c::append(cListNd_c *node) {
if (node == nullptr) {
return;
}
if (this->mpLast != nullptr) {
this->mpLast->mpNext = node;
node->mpPrev = this->mpLast;
} else {
this->mpFirst = node;
}
this->mpLast = node;
}
bool cListMg_c::prepend(cListNd_c *node) {
if (node == nullptr) {
return;
}
if (this->mpFirst != nullptr) {
this->mpFirst->mpPrev = node;
node->mpNext = this->mpFirst;
} else {
this->mpLast = node;
}
this->mpFirst = node;
}