Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
+Fixed culture points wrong calculation
  • Loading branch information
iopietro authored Feb 22, 2019
1 parent f26d335 commit c560e9b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions GameEngine/Automation.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@ function recountCP($vid){

$vid = (int) $vid;
$fdata = $database->getResourceLevel($vid);
$popTot = 0;
$cpTot = 0;

for ($i = 1; $i <= 40; $i++) {
$lvl = $fdata["f".$i];
$building = $fdata["f".$i."t"];
if($building){
$popTot += $this->buildingCP($building,$lvl);
$cpTot += $this->buildingCP($building,$lvl);
}
}

$q = "UPDATE ".TB_PREFIX."vdata set cp = $popTot where wref = $vid";
$q = "UPDATE ".TB_PREFIX."vdata set cp = $cpTot where wref = $vid";
mysqli_query($database->dblink,$q);

return $popTot;
return $cpTot;
}

function buildingPOP($f, $lvl){
Expand All @@ -150,14 +150,10 @@ function buildingPOP($f, $lvl){
function buildingCP($f, $lvl){
$name = "bid".$f;
global $$name;

$popT = 0;

$dataarray = $$name;

for ($i = 0; $i <= $lvl; $i++) {
$popT += ((isset($dataarray[$i]) && isset($dataarray[$i]['cp'])) ? $dataarray[$i]['cp'] : 0);
}
return $popT;
return ((isset($dataarray[$lvl]) && isset($dataarray[$lvl]['cp'])) ? $dataarray[$lvl]['cp'] : 0);
}

private function loyaltyRegeneration() {
Expand Down

0 comments on commit c560e9b

Please sign in to comment.