From: Roland Haeder Date: Sun, 25 Oct 2015 11:41:50 +0000 (+0100) Subject: Added missing daemon instance + added stub calls for later expansion. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3dd00063032c70ccdcb5833d10003c76d2f13d24;p=city.git Added missing daemon instance + added stub calls for later expansion. Signed-off-by: Roland Haeder --- diff --git a/application/city/classes/tasks/daemon/building/class_CityDaemonBuildingGrowthTask.php b/application/city/classes/tasks/daemon/building/class_CityDaemonBuildingGrowthTask.php index 54d6903..4f7177a 100644 --- a/application/city/classes/tasks/daemon/building/class_CityDaemonBuildingGrowthTask.php +++ b/application/city/classes/tasks/daemon/building/class_CityDaemonBuildingGrowthTask.php @@ -41,6 +41,12 @@ class CityDaemonBuildingGrowthTask extends BaseCityTask implements Taskable, Vis // Get new instance $taskInstance = new CityDaemonBuildingGrowthTask(); + // Get city daemon instance + $cityInstance = CityDaemonFactory::createCityDaemonInstance(); + + // Set it here for "caching" it + $taskInstance->setCityInstance($cityInstance); + // Return the prepared instance return $taskInstance; } @@ -64,7 +70,14 @@ class CityDaemonBuildingGrowthTask extends BaseCityTask implements Taskable, Vis * @todo 0% done */ public function executeTask () { - $this->partialStub('Unimplemented task.'); + // Get daemon instance + $cityInstance = $this->getCityInstance(); + + // Is there at least one building to expand? + if ($cityInstance->isBuildingPendingExpansion()) { + // Expand the building + $cityInstance->expandBuildings(); + } // END - if } /** diff --git a/application/city/classes/tasks/daemon/household/class_CityDaemonHouseholdGrowthTask.php b/application/city/classes/tasks/daemon/household/class_CityDaemonHouseholdGrowthTask.php index 179a927..b4de063 100644 --- a/application/city/classes/tasks/daemon/household/class_CityDaemonHouseholdGrowthTask.php +++ b/application/city/classes/tasks/daemon/household/class_CityDaemonHouseholdGrowthTask.php @@ -41,6 +41,12 @@ class CityDaemonHouseholdGrowthTask extends BaseCityTask implements Taskable, Vi // Get new instance $taskInstance = new CityDaemonHouseholdGrowthTask(); + // Get city daemon instance + $cityInstance = CityDaemonFactory::createCityDaemonInstance(); + + // Set it here for "caching" it + $taskInstance->setCityInstance($cityInstance); + // Return the prepared instance return $taskInstance; } @@ -64,7 +70,14 @@ class CityDaemonHouseholdGrowthTask extends BaseCityTask implements Taskable, Vi * @todo 0% done */ public function executeTask () { - $this->partialStub('Unimplemented task.'); + // Get daemon instance + $cityInstance = $this->getCityInstance(); + + // Is there at least one house hold to expand? + if ($cityInstance->isHouseholdPendingExpansion()) { + // Expand the house hold + $cityInstance->expandHouseholds(); + } // END - if } /**