// if this weapon is scheduled for reloading, don't switch to it during combat
if (self.weapon_load[new_weapon] < 0)
{
- float i, other_weapon_available = false;
- for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- {
- Weapon w = Weapons_from(i);
- // if we are out of ammo for all other weapons, it's an emergency to switch to anything else
- if (w.wr_checkammo1(w) + w.wr_checkammo2(w))
+ bool other_weapon_available = false;
+ FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ if(it.wr_checkammo1(it) + it.wr_checkammo2(it))
other_weapon_available = true;
- }
+ ));
if(other_weapon_available)
return true;
}
{
// If no weapon was chosen get the first available weapon
if(PS(self).m_weapon==WEP_Null)
- for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER.m_id)
- {
- if(client_hasweapon(self, Weapons_from(i), true, false))
+ FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ if(client_hasweapon(self, it, true, false))
{
- PS(self).m_switchweapon = Weapons_from(i);
+ PS(self).m_switchweapon = it;
return;
}
- }
+ ));
return;
}