Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
+Fixed a bug that permitted to train Senators and Settlers without
enough resources
  • Loading branch information
iopietro authored Apr 28, 2019
1 parent 542a393 commit d0358e4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions GameEngine/Technology.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,14 @@ private function trainUnit($unit, $amt, $great = false) {
$each = round(($bid19[$building->getTypeLevel(36)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
}
if($unit % 10 == 0 || $unit % 10 == 9 && $unit != 99) {
$slots = $database->getAvailableExpansionTraining();
if($unit % 10 == 0 && $slots['settlers'] <= $amt) $amt = $slots['settlers'];
if($unit % 10 == 9 && $slots['chiefs'] <= $amt) $amt = $slots['chiefs'];
} else {
if($this->maxUnit($unit, $great) < $amt) $amt = 0;
else
{
$slots = $database->getAvailableExpansionTraining();
if($unit % 10 == 0 && $slots['settlers'] <= $amt) $amt = $slots['settlers'];
if($unit % 10 == 9 && $slots['chiefs'] <= $amt) $amt = $slots['chiefs'];
}
}else{
if($unit != 99){
if($this->maxUnit($unit, $great) < $amt) $amt = 0;
}else{
Expand Down

0 comments on commit d0358e4

Please sign in to comment.