General fixes

+Fixed an exploit that permit to maintain the crop level constant if the
page was refreshed every second, with a negative production
This commit is contained in:
iopietro
2018-05-06 15:20:58 +02:00
parent bd033334c4
commit ec63b04587
3 changed files with 11 additions and 13 deletions
+1 -2
View File
@@ -3974,7 +3974,6 @@ class Automation {
$unitArrays = $this->getAllUnits($wref, false);
$villageUpkeep = $getVillage['pop'] + $technology->getUpkeep($unitArrays, 0, $wref);
$starv = $getVillage['starv'];
if ($crop < $villageUpkeep){
//Add starvation data
$database->setVillageFields($wref, ['starv', 'starvupdate'], [$villageUpkeep, time()]);
@@ -4156,7 +4155,7 @@ class Automation {
break;
}
$database->modifyResource($starv['wref'], 0, 0, 0, max(intval($newCrop), 0), 1);
$database->modifyResource($starv['wref'], 0, 0, 0, max($newCrop, 0), 1);
$database->setVillageField($starv['wref'], ['starv', 'starvupdate'], [$upkeep, $time]);
}
}