diff --git a/includes/GeneralFunctions.php b/includes/GeneralFunctions.php index ed1706512..cf259dfa1 100644 --- a/includes/GeneralFunctions.php +++ b/includes/GeneralFunctions.php @@ -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); diff --git a/includes/pages/game/ShowBuildingsPage.class.php b/includes/pages/game/ShowBuildingsPage.class.php index d4650fa35..2090b1223 100644 --- a/includes/pages/game/ShowBuildingsPage.class.php +++ b/includes/pages/game/ShowBuildingsPage.class.php @@ -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(); @@ -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; } diff --git a/includes/pages/game/ShowResearchPage.class.php b/includes/pages/game/ShowResearchPage.class.php index 25a7e3dce..6718e4ef7 100644 --- a/includes/pages/game/ShowResearchPage.class.php +++ b/includes/pages/game/ShowResearchPage.class.php @@ -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']) {