/** * @brief Returns the amount of assigned items for a given slot of a given aircraft * @param[in] type This is the slot type to get the amount of assigned items for * @param[in] aircraft The aircraft to count the items for (may not be NULL) * @return The amount of assigned items for the given slot */ int AIR_GetSlotItems (aircraftSlotType_t type, aircraft_t *aircraft;) { int i, cnt = 0; aircraftSlot_t *slot; assert(aircraft); switch (type) { case AIR_SLOT_WEAPONS: slot = aircraft->weapons; break; case AIR_SLOT_SHIELD: slot = aircraft->shield; break; } for (i = 0; i < MAX_AIRCRAFTSLOT; i++) if (slot[i].itemIdx >= 0) cnt++; return cnt; }