Skip to content

Commit

Permalink
Use the helper function to calculate max storage capacities of each r…
Browse files Browse the repository at this point in the history
…esource
  • Loading branch information
mdziekon committed Aug 22, 2019
1 parent 0f46cac commit 00be5cc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions admin/UserDevScanner.php
Expand Up @@ -61,9 +61,11 @@ function ResourceUpdate(&$CurrentPlanet, $CurrentUser, $StartTime, $EndTime) {
);

// Calculate Place in Storages
$CurrentPlanet['metal_max'] = (floor(BASE_STORAGE_SIZE * pow(1.7, $CurrentPlanet[$_Vars_GameElements[22]])));
$CurrentPlanet['crystal_max'] = (floor(BASE_STORAGE_SIZE * pow(1.7, $CurrentPlanet[$_Vars_GameElements[23]])));
$CurrentPlanet['deuterium_max'] = (floor(BASE_STORAGE_SIZE * pow(1.7, $CurrentPlanet[$_Vars_GameElements[24]])));
$totalCapacities = getPlanetTotalStorageCapacities($CurrentPlanet);

foreach ($totalCapacities as $resourceKey => $resourceCapacity) {
$CurrentPlanet["{$resourceKey}_max"] = $resourceCapacity;
}

$geologistTimelineSubperiods = [];
$engineerTimelineSubperiods = [];
Expand Down
8 changes: 5 additions & 3 deletions includes/functions/PlanetResourceUpdate.php
Expand Up @@ -14,9 +14,11 @@ function PlanetResourceUpdate($CurrentUser, &$CurrentPlanet, $UpdateTime, $Simul
$ProductionTime = ($UpdateTime - $CurrentPlanet['last_update']);

// Update place for resources
$CurrentPlanet['metal_max'] = (floor(BASE_STORAGE_SIZE * pow(1.7, $CurrentPlanet[$_Vars_GameElements[22]])));
$CurrentPlanet['crystal_max'] = (floor(BASE_STORAGE_SIZE * pow(1.7, $CurrentPlanet[$_Vars_GameElements[23]])));
$CurrentPlanet['deuterium_max'] = (floor(BASE_STORAGE_SIZE * pow(1.7, $CurrentPlanet[$_Vars_GameElements[24]])));
$totalCapacities = getPlanetTotalStorageCapacities($CurrentPlanet);

foreach ($totalCapacities as $resourceKey => $resourceCapacity) {
$CurrentPlanet["{$resourceKey}_max"] = $resourceCapacity;
}

// Start ResourceUpdating
if ($CurrentPlanet['planet_type'] == 1) {
Expand Down
8 changes: 5 additions & 3 deletions resources.php
Expand Up @@ -131,9 +131,11 @@ function BuildRessourcePage($CurrentUser, &$CurrentPlanet)

// -------------------------------------------------------------------------------------------------------
// Calculate Storage
$CurrentPlanet['metal_max'] = floor(BASE_STORAGE_SIZE * pow (1.7, $CurrentPlanet[$_Vars_GameElements[22]]));
$CurrentPlanet['crystal_max'] = floor(BASE_STORAGE_SIZE * pow (1.7, $CurrentPlanet[$_Vars_GameElements[23]]));
$CurrentPlanet['deuterium_max'] = floor(BASE_STORAGE_SIZE * pow (1.7, $CurrentPlanet[$_Vars_GameElements[24]]));
$totalCapacities = getPlanetTotalStorageCapacities($CurrentPlanet);

foreach ($totalCapacities as $resourceKey => $resourceCapacity) {
$CurrentPlanet["{$resourceKey}_max"] = $resourceCapacity;
}

// -------------------------------------------------------------------------------------------------------
$parse['resource_row'] = '';
Expand Down

0 comments on commit 00be5cc

Please sign in to comment.