Skip to content

Commit

Permalink
fix #560
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasKovacs committed Jun 19, 2023
1 parent 5b622d5 commit 93665c5
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions app/Http/Controllers/Game/ResearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,43 +217,22 @@ private function doCommand()
}
}

/**
* method isLaboratoryInQueue
* param
* return true if all clear, false if is anything in the queue
*/
private function isLaboratoryInQueue()
private function isLaboratoryInQueue(): bool
{
$return = true;
$current_building = '';
$element_id = 0;

if ($this->planet['planet_b_building_id'] != 0) {
$current_queue = $this->planet['planet_b_building_id'];
$queue = explode(';', $current_queue);

if (strpos($current_queue, ';')) {
$queue = explode(';', $current_queue);

for ($i = 0; $i < MAX_BUILDING_QUEUE_SIZE; $i++) {
if (isset($queue[$i])) {
$element_data = explode(',', $queue[$i]);
$element_id = $element_data[0];

if ($element_id == 31) {
break;
}
for ($i = 0; $i < MAX_BUILDING_QUEUE_SIZE; $i++) {
if (isset($queue[$i])) {
if (explode(',', $queue[$i])[0] == 31) {
return false;
}
}
} else {
$current_building = $current_queue;
}

if ($current_building == 31 or $element_id == 31) {
$return = false;
}
}

return $return;
return true;
}

/**
Expand Down

0 comments on commit 93665c5

Please sign in to comment.