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