mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
remove inside a remove after a remove... yeah.... No.
This commit is contained in:
parent
95f7205f61
commit
4a5c36352c
1 changed files with 6 additions and 6 deletions
|
|
@ -113,14 +113,14 @@ inline void SparseArray<T>::insert(T* pObject, U32 key)
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* SparseArray<T>::remove(U32 key)
|
inline T* SparseArray<T>::remove(U32 key)
|
||||||
{
|
{
|
||||||
U32 remove = key % mModulus;
|
U32 sentryID = key % mModulus;
|
||||||
Node* probe = &mSentryTables[remove];
|
Node* probe = &mSentryTables[sentryID];
|
||||||
while (probe->next != NULL) {
|
while (probe->next != NULL) {
|
||||||
if (probe->next->key == key) {
|
if (probe->next->key == key) {
|
||||||
Node* remove = probe->next;
|
Node* nextProbe = probe->next;
|
||||||
T* pReturn = remove->pObject;
|
T* pReturn = nextProbe->pObject;
|
||||||
probe->next = remove->next;
|
probe->next = nextProbe->next;
|
||||||
delete remove;
|
delete nextProbe;
|
||||||
return pReturn;
|
return pReturn;
|
||||||
}
|
}
|
||||||
probe = probe->next;
|
probe = probe->next;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue