diff --git a/AI/Skirmish/AAI/AAIMap.cpp b/AI/Skirmish/AAI/AAIMap.cpp index 7067ae22e4d..e4444139eb8 100644 --- a/AI/Skirmish/AAI/AAIMap.cpp +++ b/AI/Skirmish/AAI/AAIMap.cpp @@ -1991,7 +1991,7 @@ void AAIMap::SearchMetalSpots() } for (int i = 0; i != TotalCells; i++) // this will get the total metal a mex placed at each spot would make { - MexArrayB[i] = TempAverage[i] * 255 / MaxMetal; //scale the metal so any map will have values 0-255, no matter how much metal it has + MexArrayB[i] = SafeDivide(TempAverage[i] * 255, MaxMetal); //scale the metal so any map will have values 0-255, no matter how much metal it has } @@ -2080,7 +2080,7 @@ void AAIMap::SearchMetalSpots() } } } - MexArrayB[y * MetalMapWidth + x] = TotalMetal * 255 / MaxMetal;; //set that spots metal amount + MexArrayB[y * MetalMapWidth + x] = SafeDivide(TotalMetal * 255, MaxMetal); //set that spots metal amount } } }