fix train troops when crop is negative

This commit is contained in:
unknown
2012-04-21 12:46:14 +03:00
parent b5f214b1bb
commit a39bea6549
+4
View File
@@ -169,7 +169,11 @@ class Technology {
$woodcalc = floor($res['wood'] / ($unitarray['wood'] * ($great?3:1)));
$claycalc = floor($res['clay'] / ($unitarray['clay'] * ($great?3:1)));
$ironcalc = floor($res['iron'] / ($unitarray['iron'] * ($great?3:1)));
if($res['crop']>0){
$cropcalc = floor($res['crop'] / ($unitarray['crop'] * ($great?3:1)));
}else{
$cropcalc = 0;
}
$popcalc = floor($village->getProd("crop")/$unitarray['pop']);
return min($woodcalc,$claycalc,$ironcalc,$cropcalc);
}