Răsfoiți Sursa

Fixed CID 1288882

DjWarmonger 9 ani în urmă
părinte
comite
a86edca7d8
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      AI/VCAI/Fuzzy.cpp

+ 1 - 1
AI/VCAI/Fuzzy.cpp

@@ -219,7 +219,7 @@ ui64 FuzzyHelper::estimateBankDanger (const CBank * bank)
 		totalStrength += config.second.totalStrength * config.first;
 		totalStrength += config.second.totalStrength * config.first;
 		totalChance += config.first;
 		totalChance += config.first;
 	}
 	}
-	return totalStrength / totalChance;
+	return totalStrength / std::max<ui8>(totalChance, 1); //avoid division by zero
 
 
 }
 }