]> git.mxchange.org Git - city.git/commitdiff
Added missing daemon instance + added stub calls for later expansion.
authorRoland Haeder <roland@mxchange.org>
Sun, 25 Oct 2015 11:41:50 +0000 (12:41 +0100)
committerRoland Haeder <roland@mxchange.org>
Sun, 25 Oct 2015 11:41:50 +0000 (12:41 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
application/city/classes/tasks/daemon/building/class_CityDaemonBuildingGrowthTask.php
application/city/classes/tasks/daemon/household/class_CityDaemonHouseholdGrowthTask.php

index 54d6903f67326800cd3ef94cc448bb919913ce72..4f7177a193db4c3ddb5e3ddec1de8c8fea0413e8 100644 (file)
@@ -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
        }
 
        /**
index 179a92784050aa049adeec831d3bca2c252a25ca..b4de063597a0d23932e54b461f1ed60ad6445987 100644 (file)
@@ -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
        }
 
        /**