mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-25 14:52:30 +01:00
refactor linked lists
This commit is contained in:
parent
77aa28bbc7
commit
91070f80d0
@ -4,6 +4,9 @@
|
|||||||
template <class T>
|
template <class T>
|
||||||
class CLinkSA
|
class CLinkSA
|
||||||
{
|
{
|
||||||
|
template <class T>
|
||||||
|
friend class CLinkListSA;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline void Insert(CLinkSA<T>* pAttach) {
|
inline void Insert(CLinkSA<T>* pAttach) {
|
||||||
pAttach->m_pNext = m_pNext;
|
pAttach->m_pNext = m_pNext;
|
||||||
@ -26,10 +29,15 @@ public:
|
|||||||
m_pPrev->m_pNext = m_pNext;
|
m_pPrev->m_pNext = m_pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline T& V(void) {
|
inline T& operator*(void) {
|
||||||
return m_pItem;
|
return m_pItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const T& operator*(void) const {
|
||||||
|
return m_pItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
T m_pItem; // 0-4
|
T m_pItem; // 0-4
|
||||||
// an item
|
// an item
|
||||||
CLinkSA<T>* m_pPrev; // 4-8
|
CLinkSA<T>* m_pPrev; // 4-8
|
||||||
@ -141,9 +149,7 @@ public:
|
|||||||
if(pCurrent->m_pNext == &m_lnListTail) {
|
if(pCurrent->m_pNext == &m_lnListTail) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else {
|
return pCurrent->m_pNext;
|
||||||
return pCurrent->m_pNext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLinkSA<T>* Prev(CLinkSA<T>* pCurrent) {
|
CLinkSA<T>* Prev(CLinkSA<T>* pCurrent) {
|
||||||
@ -154,11 +160,10 @@ public:
|
|||||||
if(pCurrent->m_pPrev == &m_lnListHead) {
|
if(pCurrent->m_pPrev == &m_lnListHead) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else {
|
return pCurrent->m_pPrev;
|
||||||
return pCurrent->m_pPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
CLinkSA<T> m_lnListHead; // 0-12
|
CLinkSA<T> m_lnListHead; // 0-12
|
||||||
//head of the list of active links
|
//head of the list of active links
|
||||||
CLinkSA<T> m_lnListTail; // 12-24
|
CLinkSA<T> m_lnListTail; // 12-24
|
||||||
|
@ -432,9 +432,10 @@ void RenderWeaponPedsForPC()
|
|||||||
|
|
||||||
for ( auto it = ms_weaponPedsForPC.Next( nullptr ); it != nullptr; it = ms_weaponPedsForPC.Next( it ) )
|
for ( auto it = ms_weaponPedsForPC.Next( nullptr ); it != nullptr; it = ms_weaponPedsForPC.Next( it ) )
|
||||||
{
|
{
|
||||||
it->V()->SetupLighting();
|
CPed* ped = **it;
|
||||||
it->V()->RenderWeapon(true, false);
|
ped->SetupLighting();
|
||||||
it->V()->RemoveLighting();
|
ped->RenderWeapon(true, false);
|
||||||
|
ped->RemoveLighting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user