A bitvec / bitflag is basically an array of boolean values, so you might as well get the contents of
m_upgradeBitVec and check your requirements against it; something like the following (untested):
Code:
// contains bitflag of upgrades (m_upgradeBitVec)
int upgradeBitVec;
// you'd want to translate the cvar to the corresponding bitvec somehow, your choice on implementation
// for the sake of example, I'll fill them in:
int vipUpgradeChoice = L4D2_WEPUPGFLAG_INCENDIARY;
int regUpgradeChoice = L4D2_WEPUPGFLAG_LASER;
// true if the player has either incendiary or explosive upgrades
// I'm not sure what your desired behavior is in that case so you'll have to work that out
bool hasMutuallyExclusiveUpgrade = upgradeBitVec & (L4D2_WEPUPGFLAG_INCENDIARY | L4D2_WEPUPGFLAG_EXPLOSIVE);
if (vipUpgradeChoice != L4D2_WEPUPGFLAG_NONE && bIsVip && !(upgradeBitVec & vipUpgradeChoice)) {
// they are VIP and they don't have this upgrade, so apply it
// TODO apply the VIP upgrade here
} else if (regUpgradeChoice != L4D2_WEPUPGFLAG_NONE && !(upgradeBitVec & regUpgradeChoice)) {
// they aren't VIP or they already had the upgrade
// TODO apply the regular upgrade here
}
__________________