Gets next weapon from n that has actually been alloced
| 503 | |
| 504 | // Gets next weapon from n that has actually been alloced |
| 505 | int 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 |
| 526 | int GetPrevWeapon(int n) { |
no outgoing calls
no test coverage detected