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

Method SelectSP

src/SB/Game/zNPCSpawner.cpp:504–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502}
503
504SMSPStatus* zNPCSpawner::SelectSP(const SMNPCStatus* npcstat)
505{
506 SMSPStatus* sp_stat;
507
508 if (npcstat->sp_prefer != NULL)
509 {
510 sp_stat = StatForSP(npcstat->sp_prefer, 1);
511 if (!sp_stat->sp->IsOn())
512 {
513 return NULL;
514 }
515
516 if (!IsSPLZClear(sp_stat->sp))
517 {
518 return NULL;
519 }
520
521 return sp_stat;
522 }
523 else
524 {
525 S32 rc = 0;
526 S32 cnt = 0;
527
528 SMSPStatus* splist[16] = {};
529
530 for (S32 i = 0; i < 16; i++)
531 {
532 SMSPStatus* tmp_stat = &sppool[i];
533 if (tmp_stat->sp != NULL && tmp_stat->sp->on && splist[i] == NULL &&
534 IsSPLZClear(sppool[i].sp))
535 {
536 splist[i] = tmp_stat;
537 cnt += 1;
538 }
539
540 rc++;
541 }
542
543 if (!cnt)
544 {
545 sp_stat = NULL;
546 }
547 else
548 {
549 sp_stat = xUtil_select<SMSPStatus>(splist, rc, NULL);
550 }
551 }
552
553 return sp_stat;
554}
555
556SMNPCStatus* zNPCSpawner::NextPendingNPC(S32 arg0)
557{

Callers

nothing calls this directly

Calls 2

IsSPLZClearFunction · 0.85
IsOnMethod · 0.80

Tested by

no test coverage detected