From 3dd00063032c70ccdcb5833d10003c76d2f13d24 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sun, 25 Oct 2015 12:41:50 +0100 Subject: [PATCH] Added missing daemon instance + added stub calls for later expansion. Signed-off-by: Roland Haeder --- .../class_CityDaemonBuildingGrowthTask.php | 15 ++++++++++++++- .../class_CityDaemonHouseholdGrowthTask.php | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) 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 } /** -- 2.39.5