Преглед изворни кода

Call cheap to compute conditions before costly conditions

Ivan Savenko пре 1 година
родитељ
комит
f5a64a0ac5
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      lib/battle/CUnitState.cpp

+ 2 - 2
lib/battle/CUnitState.cpp

@@ -46,7 +46,7 @@ int32_t CAmmo::available() const
 
 
 bool CAmmo::canUse(int32_t amount) const
 bool CAmmo::canUse(int32_t amount) const
 {
 {
-	return !isLimited() || (available() - amount >= 0);
+	return (available() - amount >= 0) || !isLimited();
 }
 }
 
 
 bool CAmmo::isLimited() const
 bool CAmmo::isLimited() const
@@ -99,7 +99,7 @@ CShots & CShots::operator=(const CShots & other)
 
 
 bool CShots::isLimited() const
 bool CShots::isLimited() const
 {
 {
-	return !env->unitHasAmmoCart(owner) || !shooter.getHasBonus();
+	return !shooter.getHasBonus() || !env->unitHasAmmoCart(owner);
 }
 }
 
 
 void CShots::setEnv(const IUnitEnvironment * env_)
 void CShots::setEnv(const IUnitEnvironment * env_)