mirror of
https://github.com/halpz/re3.git
synced 2025-07-13 11:58:14 +00:00
Reorder CEntity functions into their original order
This commit is contained in:
@ -21,6 +21,83 @@ CReferences::Init(void)
|
||||
aRefs[NUMREFERENCES-1].next = nil;
|
||||
}
|
||||
|
||||
void
|
||||
CEntity::RegisterReference(CEntity **pent)
|
||||
{
|
||||
if(IsBuilding())
|
||||
return;
|
||||
CReference *ref;
|
||||
// check if already registered
|
||||
for(ref = m_pFirstReference; ref; ref = ref->next)
|
||||
if(ref->pentity == pent)
|
||||
return;
|
||||
// have to allocate new reference
|
||||
ref = CReferences::pEmptyList;
|
||||
if(ref){
|
||||
CReferences::pEmptyList = ref->next;
|
||||
|
||||
ref->pentity = pent;
|
||||
ref->next = m_pFirstReference;
|
||||
m_pFirstReference = ref;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Clean up the reference from *pent -> 'this'
|
||||
void
|
||||
CEntity::CleanUpOldReference(CEntity **pent)
|
||||
{
|
||||
CReference* ref, ** lastnextp;
|
||||
lastnextp = &m_pFirstReference;
|
||||
for (ref = m_pFirstReference; ref; ref = ref->next) {
|
||||
if (ref->pentity == pent) {
|
||||
*lastnextp = ref->next;
|
||||
ref->next = CReferences::pEmptyList;
|
||||
CReferences::pEmptyList = ref;
|
||||
break;
|
||||
}
|
||||
lastnextp = &ref->next;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear all references to this entity
|
||||
void
|
||||
CEntity::ResolveReferences(void)
|
||||
{
|
||||
CReference *ref;
|
||||
// clear pointers to this entity
|
||||
for(ref = m_pFirstReference; ref; ref = ref->next)
|
||||
if(*ref->pentity == this)
|
||||
*ref->pentity = nil;
|
||||
// free list
|
||||
if(m_pFirstReference){
|
||||
for(ref = m_pFirstReference; ref->next; ref = ref->next)
|
||||
;
|
||||
ref->next = CReferences::pEmptyList;
|
||||
CReferences::pEmptyList = m_pFirstReference;
|
||||
m_pFirstReference = nil;
|
||||
}
|
||||
}
|
||||
|
||||
// Free all references that no longer point to this entity
|
||||
void
|
||||
CEntity::PruneReferences(void)
|
||||
{
|
||||
CReference *ref, *next, **lastnextp;
|
||||
lastnextp = &m_pFirstReference;
|
||||
for(ref = m_pFirstReference; ref; ref = next){
|
||||
next = ref->next;
|
||||
if(*ref->pentity == this)
|
||||
lastnextp = &ref->next;
|
||||
else{
|
||||
*lastnextp = ref->next;
|
||||
ref->next = CReferences::pEmptyList;
|
||||
CReferences::pEmptyList = ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CReferences::RemoveReferencesToPlayer(void)
|
||||
{
|
||||
|
@ -1643,14 +1643,24 @@ CWorld::ExtinguishAllCarFiresInArea(CVector point, float range)
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
AddSteamsFromGround(CPtrList& list)
|
||||
{
|
||||
CPtrNode* pNode = list.first;
|
||||
while (pNode) {
|
||||
((CEntity*)pNode->item)->AddSteamsFromGround(nil);
|
||||
pNode = pNode->next;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CWorld::AddParticles(void)
|
||||
{
|
||||
for(int32 y = 0; y < NUMSECTORS_Y; y++) {
|
||||
for(int32 x = 0; x < NUMSECTORS_X; x++) {
|
||||
CSector *pSector = GetSector(x, y);
|
||||
CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]);
|
||||
CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]);
|
||||
AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]);
|
||||
AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user