MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / GetNextWeapon

Function GetNextWeapon

Descent3/weapon.cpp:505–523  ·  view source on GitHub ↗

Gets next weapon from n that has actually been alloced

Source from the content-addressed store, hash-verified

503
504// Gets next weapon from n that has actually been alloced
505int GetNextWeapon(int n) {
506 int i;
507
508 ASSERT(n >= 0 && n < MAX_WEAPONS);
509
510 if (Num_weapons == 0)
511 return -1;
512
513 for (i = n + 1; i < MAX_WEAPONS; i++)
514 if (Weapons[i].used)
515 return i;
516 for (i = 0; i < n; i++)
517 if (Weapons[i].used)
518 return i;
519
520 // this is the only one
521
522 return n;
523}
524
525// Gets previous weapon from n that has actually been alloced
526int GetPrevWeapon(int n) {

Callers 4

OnDeleteWeaponMethod · 0.85
OnNextWeaponMethod · 0.85
UpdateDialogMethod · 0.85
OnChangeNameMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected