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

Function TCSSCollectInfo

Descent3/TelCom.cpp:3651–4119  ·  view source on GitHub ↗

collects information about the ships, returns the number of ships available

Source from the content-addressed store, hash-verified

3649
3650// collects information about the ships, returns the number of ships available
3651int TCSSCollectInfo(void) {
3652 int found = 0;
3653 int i, j;
3654
3655 for (i = 0; i < MAX_NUM_SHIPS; i++) {
3656 SSShips[i].found = false;
3657 }
3658
3659 for (i = 0; i < MAX_SHIPS; i++) {
3660#ifdef _DEBUG
3661 if (Ships[i].used) {
3662#else
3663 if (Ships[i].used && PlayerIsShipAllowed(Player_num, i)) {
3664#endif
3665 for (j = 0; j < MAX_NUM_SHIPS; j++) {
3666 if (!stricmp(Ships[i].name, AllowedShips[j])) {
3667 // found the ship
3668 SSShips[j].found = true;
3669 SSShips[j].ship_index = i;
3670 found++;
3671 break;
3672 }
3673 }
3674 }
3675 }
3676
3677 mprintf(0, "Collecting Ship Info: %d ships available\n", found);
3678 TCShipSelect.ShipCount = found;
3679
3680 return found;
3681}
3682
3683//====================================
3684// returns the optimal distance to place the camera
3685float getdist(angle ang, float height); // in pilot.cpp
3686extern float Render_zoom;
3687
3688//====================================
3689
3690void TCSSButtonCallback(int efxnum) {
3691 if (!TCEffects[efxnum].has_focus) {
3692 // make sure we have focus...be careful, because by setting focus
3693 // the call is going to come back into this function
3694 TelComSetFocusOnEffect(efxnum);
3695 return;
3696 }
3697
3698 int selected_id = -1;
3699
3700 // which ship id are we talking about?
3701 for (int i = 0; i < MAX_NUM_SHIPS; i++) {
3702 if (SSShips[i].found && SSShips[i].efxnum == efxnum) {
3703 // this is the id;
3704 selected_id = i;
3705 break;
3706 }
3707 }
3708

Callers 1

TelComSingleShipSelectFunction · 0.85

Calls 1

PlayerIsShipAllowedFunction · 0.85

Tested by

no test coverage detected