From 13e21d66e19b846c0d814b01bfedad6fa6afa0fa Mon Sep 17 00:00:00 2001 From: iopietro Date: Sat, 21 Apr 2018 20:34:43 +0200 Subject: [PATCH] Fixed a bug while finishing a construction +Buildings cannot be incremented anymore by two levels instead of one --- GameEngine/Automation.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 62b1ddde..35a78397 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -584,7 +584,7 @@ class Automation { } private function buildComplete() { - global $database,$bid18,$bid10,$bid11,$bid38,$bid39; + global $database, $bid18, $bid10, $bid11, $bid38, $bid39; if(file_exists("GameEngine/Prevention/build.txt")) { unlink("GameEngine/Prevention/build.txt"); @@ -624,15 +624,9 @@ class Automation { $villageData = $database->getVillageFields($indi['wid'],'owner, maxcrop, maxstore, starv, pop'); $villageOwner = $villageData['owner']; $villagesAffected[] = (int) $indi['wid']; - $level = $database->getFieldLevel($indi['wid'],$indi['field']); $fieldsToSet = []; - - if (($level + 1) == $indi['level']){ - $q = "UPDATE ".TB_PREFIX."fdata set f".$indi['field']." = ".$indi['level'].", f".$indi['field']."t = ".$indi['type']." where vref = ".(int) $indi['wid']; - } else { - $indi['level'] = ($level + 1); - $q = "UPDATE ".TB_PREFIX."fdata set f".$indi['field']." = ".$indi['level'].", f".$indi['field']."t = ".$indi['type']." where vref = ".(int) $indi['wid']; - } + + $q = "UPDATE ".TB_PREFIX."fdata SET f".$indi['field']." = ".$indi['level'].", f".$indi['field']."t = ".$indi['type']." WHERE vref = ".(int) $indi['wid']; if($database->query($q)) { // this will be the level we brought the building to now