MCPcopy Create free account
hub / github.com/JACoders/OpenJK / G_PickTarget

Function G_PickTarget

code/game/g_utils.cpp:570–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568#define MAXCHOICES 32
569
570gentity_t *G_PickTarget (char *targetname)
571{
572 gentity_t *ent = NULL;
573 int num_choices = 0;
574 gentity_t *choice[MAXCHOICES];
575
576 if (!targetname)
577 {
578 gi.Printf("G_PickTarget called with NULL targetname\n");
579 return NULL;
580 }
581
582 while(1)
583 {
584 ent = G_Find (ent, FOFS(targetname), targetname);
585 if (!ent)
586 break;
587 choice[num_choices++] = ent;
588 if (num_choices == MAXCHOICES)
589 break;
590 }
591
592 if (!num_choices)
593 {
594 gi.Printf("G_PickTarget: target %s not found\n", targetname);
595 return NULL;
596 }
597
598 return choice[rand() % num_choices];
599}
600
601void G_UseTargets2 (gentity_t *ent, gentity_t *activator, const char *string)
602{

Callers 7

AimAtTargetFunction · 0.70
trigger_teleporter_touchFunction · 0.70
target_teleporter_useFunction · 0.70
target_relay_use_goFunction · 0.70
teleporter_touchFunction · 0.70
setCameraFunction · 0.70
InitShooterFunction · 0.70

Calls 1

G_FindFunction · 0.70

Tested by

no test coverage detected