Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from mys/master
Browse files Browse the repository at this point in the history
Fix cancel research/building queues error
  • Loading branch information
mys committed Jan 28, 2018
2 parents ead0796 + e944e64 commit 76821d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions includes/GeneralFunctions.php
Expand Up @@ -140,10 +140,7 @@ function _date($format, $time = null, $toTimeZone = null, $LNG = NULL)
$date = new DateTime();
if(method_exists($date, 'setTimestamp'))
{ // PHP > 5.3
$time = round(TIMESTAMP);
$tempDate = getdate((int) $time);
$date->setDate($tempDate['year'], $tempDate['mon'], $tempDate['mday']);
$date->setTime($tempDate['hours'], $tempDate['minutes'], $tempDate['seconds']);
$date->setTimestamp($time);
} else {
// PHP < 5.3
$tempDate = getdate((int) $time);
Expand Down
4 changes: 2 additions & 2 deletions includes/pages/game/ShowBuildingsPage.class.php
Expand Up @@ -93,7 +93,7 @@ private function RemoveBuildingFromQueue($QueueID)
return;
}

$Element = $CurrentQueue[$QueueID - 2][0];
$Element = $CurrentQueue[$QueueID - 1][0];
$BuildEndTime = $CurrentQueue[$QueueID - 2][3];
unset($CurrentQueue[$QueueID - 1]);
$NewQueueArray = array();
Expand All @@ -105,7 +105,7 @@ private function RemoveBuildingFromQueue($QueueID)
if($Element == $ListIDArray[0] || empty($ListIDArray[0]))
continue;

$BuildEndTime += BuildFunctions::getBuildingTime($USER, $PLANET, $ListIDArray[0], NULL, $ListIDArray[4] == 'destroy', $ListIDArray[2]);
$BuildEndTime += BuildFunctions::getBuildingTime($USER, $PLANET, $ListIDArray[0], NULL, $ListIDArray[4] == 'destroy', $ListIDArray[1]);
$ListIDArray[3] = $BuildEndTime;
$NewQueueArray[] = $ListIDArray;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/pages/game/ShowResearchPage.class.php
Expand Up @@ -58,7 +58,7 @@ private function CancelBuildingFromQueue()
$db = Database::get();

$elementId = $USER['b_tech_id'];
$costResources = BuildFunctions::getElementPrice($USER, $PLANET, $elementId, false, $PLANET[$elementId] + 1);
$costResources = BuildFunctions::getElementPrice($USER, $PLANET, $elementId, false, $USER[$resource[$elementId]] + 1);

if($PLANET['id'] == $USER['b_tech_planet'])
{
Expand Down

0 comments on commit 76821d3

Please sign in to comment.