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 d3b420b commit 7a6bd8c
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions GameEngine/Automation.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function recountPop($vid, $use_cache = true){
if($building) $popTot += $this->buildingPOP($building, $lvl);
}

$this->recountCP($vid);
Building::recountCP($database, $vid);
$q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid";
mysqli_query($database->dblink, $q);
$owner = $database->getVillageField($vid, "owner");
Expand All @@ -113,27 +113,6 @@ function recountPop($vid, $use_cache = true){
return $popTot;
}

function recountCP($vid){
global $database;

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

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

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

return $cpTot;
}

function buildingPOP($f, $lvl){
$name = "bid".$f;
global $$name;
Expand All @@ -147,15 +126,6 @@ function buildingPOP($f, $lvl){
return $popT;
}

function buildingCP($f, $lvl){
$name = "bid".$f;
global $$name;

$dataarray = $$name;

return ((isset($dataarray[$lvl]) && isset($dataarray[$lvl]['cp'])) ? $dataarray[$lvl]['cp'] : 0);
}

private function loyaltyRegeneration() {
global $database;

Expand Down

0 comments on commit 7a6bd8c

Please sign in to comment.