mirror of https://github.com/AxioDL/metaforce.git
CSortedLists: Remove use of const_cast in AddToLinkedList()
Same behavior, but nicer to read.
This commit is contained in:
parent
6d2ef0360f
commit
eecd03428d
|
@ -30,17 +30,19 @@ void CSortedListManager::Reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSortedListManager::AddToLinkedList(s16 nodeId, s16& headId, s16& tailId) const {
|
void CSortedListManager::AddToLinkedList(s16 nodeId, s16& headId, s16& tailId) {
|
||||||
if (headId == -1) {
|
if (headId == -1) {
|
||||||
const_cast<SNode&>(AccessElement(x0_nodes, nodeId)).x28_next = headId;
|
AccessElement(x0_nodes, nodeId).x28_next = headId;
|
||||||
headId = nodeId;
|
headId = nodeId;
|
||||||
tailId = nodeId;
|
tailId = nodeId;
|
||||||
} else {
|
} else {
|
||||||
if (AccessElement(x0_nodes, nodeId).x28_next != -1)
|
if (AccessElement(x0_nodes, nodeId).x28_next != -1) {
|
||||||
return;
|
return;
|
||||||
if (tailId == nodeId)
|
}
|
||||||
|
if (tailId == nodeId) {
|
||||||
return;
|
return;
|
||||||
const_cast<SNode&>(AccessElement(x0_nodes, nodeId)).x28_next = headId;
|
}
|
||||||
|
AccessElement(x0_nodes, nodeId).x28_next = headId;
|
||||||
headId = nodeId;
|
headId = nodeId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CSortedListManager {
|
||||||
std::array<SNode, 1024> x0_nodes;
|
std::array<SNode, 1024> x0_nodes;
|
||||||
std::array<SSortedList, 6> xb000_sortedLists;
|
std::array<SSortedList, 6> xb000_sortedLists;
|
||||||
void Reset();
|
void Reset();
|
||||||
void AddToLinkedList(s16 a, s16& b, s16& c) const;
|
void AddToLinkedList(s16 a, s16& b, s16& c);
|
||||||
void RemoveFromList(ESortedList, s16);
|
void RemoveFromList(ESortedList, s16);
|
||||||
void MoveInList(ESortedList, s16);
|
void MoveInList(ESortedList, s16);
|
||||||
void InsertInList(ESortedList, SNode& node);
|
void InsertInList(ESortedList, SNode& node);
|
||||||
|
|
Loading…
Reference in New Issue