MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xParGroupAddPar

Function xParGroupAddPar

src/SB/Core/x/xParGroup.cpp:194–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194xPar* xParGroupAddPar(xParGroup* ps)
195{
196 xPar* p;
197
198 if (ps->m_flags & XPARGROUP_ALLOCPARS)
199 {
200 p = xParAlloc();
201
202 if (!p)
203 {
204 S32 myPriority = ps->m_priority;
205
206 for (U8 i = 0; i < REG_TABLE_SIZE; i++)
207 {
208 if (sParGroupRegTable[i] && sParGroupRegTable[i] != ps &&
209 (sParGroupRegTable[i]->m_flags & XPARGROUP_ALLOCPARS) &&
210 !(sParGroupRegTable[i]->m_flags & XPARGROUP_UNK10) &&
211 sParGroupRegTable[i]->m_priority < myPriority && sParGroupRegTable[i]->m_root)
212 {
213 xParGroupKillPar(sParGroupRegTable[i], sParGroupRegTable[i]->m_root);
214
215 p = xParAlloc();
216
217 break;
218 }
219 }
220 }
221 }
222 else if (ps->m_dead)
223 {
224 p = ps->m_dead;
225 ps->m_dead = p->m_next;
226
227 if (ps->m_dead)
228 {
229 ps->m_dead->m_prev = NULL;
230 }
231 }
232 else
233 {
234 p = NULL;
235 }
236
237 if (p)
238 {
239 xParInit(p);
240 xParGroupAddParP(ps, p);
241 }
242
243 return p;
244}
245
246void xParGroupKillPar(xParGroup* ps, xPar* p)
247{

Callers 1

xParEmitterEmitFunction · 0.70

Calls 4

xParAllocFunction · 0.85
xParGroupKillParFunction · 0.85
xParInitFunction · 0.85
xParGroupAddParPFunction · 0.85

Tested by

no test coverage detected