// Returns the number of weapons available for launch unsigned int Stores::available() const { unsigned int n = 0; for (unsigned int s = 1; s <= ns; s++) { if ( isWeaponAvailable(s) ) n++; } return n; }
void Player::cycleWeapons() { LevelState level = parent->getParent()->getLevelState(); int newWeapon = (currentWeapon + 1) % 4; while (!isWeaponAvailable(newWeapon)) { newWeapon = (newWeapon + 1) % 4; } if (currentWeapon != newWeapon) { parent->getParent()->playSample("Sound2"); currentWeapon = newWeapon; setState (false); } else { parent->getParent()->playSample("Sound1"); } }