refactor: for loops optimized

#313
This commit is contained in:
Martin Ambrus
2017-11-19 15:17:24 +01:00
parent 2a68b07704
commit 699781d130
6 changed files with 166 additions and 69 deletions
+3 -1
View File
@@ -235,7 +235,9 @@ class Village {
$bakery = $this->resarray['f'.$i];
}
}
for($i=0;$i<=count($cropholder)-1;$i++) { $basecrop+= $bid4[$this->resarray[$cropholder[$i]]]['prod']; }
for ( $i = 0; $i <= count( $cropholder ) - 1; $i ++ ) {
$basecrop += $bid4[ $this->resarray[ $cropholder[ $i ] ] ]['prod'];
}
$crop = $basecrop + $basecrop * 0.25 * $this->ocounter[3];
if($grainmill >= 1 || $bakery >= 1) {
$crop += $basecrop /100 * (isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0) + (isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0);