Skip to content

Commit

Permalink
fix bug calculate training settlers/chiefs
Browse files Browse the repository at this point in the history
when the village send settlers or chiefs as reinforcement more than 2 village, it Incorrect calculation
  • Loading branch information
arafarn12 authored Jul 11, 2019
1 parent 693afb4 commit 4f4e623
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions GameEngine/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -7164,22 +7164,16 @@ public function getAvailableExpansionTraining() {
}
}

$q = "SELECT (u10+u20+u30) FROM " . TB_PREFIX . "enforcement WHERE `from` = ".(int) $village->wid;
$q = "SELECT (u10+u20+u30) as sumsettlers FROM " . TB_PREFIX . "enforcement WHERE `from` = ".(int) $village->wid;
$result = mysqli_query($this->dblink,$q);
$row = mysqli_fetch_row($result);
if(!empty($row)) {
foreach($row as $reinf) {
$settlers += $reinf[0];
}
while($settlersrow = mysqli_fetch_array($result)) {
$settlers += $settlersrow["sumsettlers"];
}

$q = "SELECT (u9+u19+u29) FROM " . TB_PREFIX . "enforcement WHERE `from` = ".(int) $village->wid;
$q = "SELECT (u9+u19+u29) as sumchiefs FROM " . TB_PREFIX . "enforcement WHERE `from` = ".(int) $village->wid;
$result = mysqli_query($this->dblink,$q);
$row = mysqli_fetch_row($result);
if(!empty($row)) {
foreach($row as $reinf) {
$chiefs += $reinf[0];
}
while($chiefsrow = mysqli_fetch_array($result)) {
$chiefs += $chiefsrow["sumchiefs"];
}

$trainlist = $technology->getTrainingList(4);
Expand Down

0 comments on commit 4f4e623

Please sign in to comment.