diff --git a/SilentPatchSA/LinkListSA.h b/SilentPatchSA/LinkListSA.h index 65f859f..6ef2e9f 100644 --- a/SilentPatchSA/LinkListSA.h +++ b/SilentPatchSA/LinkListSA.h @@ -4,6 +4,9 @@ template class CLinkSA { + template + friend class CLinkListSA; + public: inline void Insert(CLinkSA* 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* 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* Prev(CLinkSA* 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 m_lnListHead; // 0-12 //head of the list of active links CLinkSA m_lnListTail; // 12-24 diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index d6bfae0..eb01ec6 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -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(); } }