]> git.mxchange.org Git - city.git/commitdiff
Added task 'household_growth' + updated 'core'.
authorRoland Haeder <roland@mxchange.org>
Mon, 29 Jun 2015 03:08:22 +0000 (05:08 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 29 Jun 2015 03:13:11 +0000 (05:13 +0200)
Signed-off-by: Roland Haeder <roland@mxchange.org>
application/city/config.php
application/city/main/filter/task/city_daemon/class_CityDaemonTaskHandlerInitializerFilter.php
application/city/main/tasks/daemon/household/.htaccess [new file with mode: 0644]
application/city/main/tasks/daemon/household/class_CityDaemonHouseholdGrowthTask.php [new file with mode: 0644]
core
docs/tasks.txt

index 9a3e9b2794189e99b7f2ab9a2bc8da0c6f526f02..63e6786cd1242c142c6a927dd9d467634df4e708 100644 (file)
@@ -543,5 +543,17 @@ $cfg->setConfigEntry('task_map_expander_interval_delay', 100);
 // CFG: TASK-MAP-EXPANDER-MAX-RUNS
 $cfg->setConfigEntry('task_map_expander_max_runs', 0);
 
+// CFG: CITY-DAEMON-HOUSEHOLD-GROWTH-TASK-CLASS
+$cfg->setConfigEntry('city_daemon_household_growth_task_class', 'CityDaemonHouseholdGrowthTask');
+
+// CFG: TASK-HOUSEHOLD-GROWTH-STARTUP-DELAY
+$cfg->setConfigEntry('task_household_growth_startup_delay', 1000);
+
+// CFG: TASK-HOUSEHOLD-GROWTH-INTERVAL-DELAY
+$cfg->setConfigEntry('task_household_growth_interval_delay', 200);
+
+// CFG: TASK-HOUSEHOLD-GROWTH-MAX-RUNS
+$cfg->setConfigEntry('task_household_growth_max_runs', 0);
+
 // [EOF]
 ?>
index b2d3e4c15470c7416b6ff049e949e4d497767330..893a9103038f41ef2680e977ba7f757ec4e92d1f 100644 (file)
@@ -70,6 +70,12 @@ class CityDaemonTaskHandlerInitializerFilter extends BaseCityFilter implements F
                // Register it
                $handlerInstance->registerTask('map_expander', $taskInstance);
 
+               // Prepare a household growth task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('city_daemon_household_growth_task_class');
+
+               // Register it
+               $handlerInstance->registerTask('household_growth', $taskInstance);
+
                /*
                 * Add extra tasks depending on daemon modus.
                 */
diff --git a/application/city/main/tasks/daemon/household/.htaccess b/application/city/main/tasks/daemon/household/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/tasks/daemon/household/class_CityDaemonHouseholdGrowthTask.php b/application/city/main/tasks/daemon/household/class_CityDaemonHouseholdGrowthTask.php
new file mode 100644 (file)
index 0000000..ea041ed
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * A HouseholdGrowth city daemon-task
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+class CityDaemonHouseholdGrowthTask extends BaseTask implements Taskable, Visitable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $taskInstance   An instance of a Visitable class
+        */
+       public final static function createCityDaemonHouseholdGrowthTask () {
+               // Get new instance
+               $taskInstance = new CityDaemonHouseholdGrowthTask();
+
+               // Return the prepared instance
+               return $taskInstance;
+       }
+
+       /**
+        * Accepts the visitor to process the visitor
+        *
+        * @param       $visitorInstance        An instance of a Visitor class
+        * @return      void
+        * @todo        Maybe visit some sub-objects
+        */
+       public function accept (Visitor $visitorInstance) {
+               // Visit this task
+               $visitorInstance->visitTask($this);
+       }
+
+       /**
+        * Executes the task
+        *
+        * @return      void
+        * @todo        0% done
+        */
+       public function executeTask () {
+               $this->partialStub('Unimplemented task.');
+       }
+
+       /**
+        * Shuts down the task
+        *
+        * @return      void
+        * @todo        0% done
+        */
+       public function doShutdown () {
+               self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...');
+       }
+}
+
+// [EOF]
+?>
diff --git a/core b/core
index 15bab1114f3d4e33c67d035a7d3c20a8babeee81..925de61d0c6e97459a30df160ab88daeab74b795 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 15bab1114f3d4e33c67d035a7d3c20a8babeee81
+Subproject commit 925de61d0c6e97459a30df160ab88daeab74b795
index 364a88d57e1ee721822778853709087cde01b399..475910c14346188aa0fd72c38046afdbf8418636 100644 (file)
@@ -1,10 +1,11 @@
 The following tasks are used:
 -----------------------------
 
-Name          | Description
---------------+--------------------------------
- map_expander | Expands the city map if needed
---------------+--------------------------------
+ Name             | Done | Description
+------------------+------+--------------------------------
+ map_expander     |   0% | Expands the city map if needed
+ household_growth |   0% | Growths a single household
+------------------+------+--------------------------------
 
 - - - - -
 
@@ -25,4 +26,36 @@ close ("city border threashold") to the border (default: 10). If that value
 has reached or surpassed (to close, e.g. by constructing a long road) the map
 is expanded (default: 10+100 from outer-most).
 
+- - - - -
+
+Task 'household_growth':
+------------------------
+
+The task is responsible for growing all households. The task checks if an empty
+zone is given and several pre-conditions are met:
+
+1) A road/path way is nearby (must be given but it will be checked anyway).
+
+2) The zone is not to small (minimum: 2x1 as 1 square must be given as distance
+   to the road. This however will be pre-checked by the client.
+
+3) The land value of the resitential zone is not to low (below zero) as this
+   hinders that people move in. Please note that some other zones (e.g.
+   landfills) may reduce land value around them).
+
+4) The land value is not to high for the citizen (cannot effort to buy the
+   zone).
+
+5) There is no initial "building" (e.g. hut) on the zone or the existing
+   building is a multi-household building and has at least one appartment for
+   sale. Please note that rich people prefer low-density and high land-value
+   zones over high-density zones except it is an expansive multi-household
+   building.
+
+The task also checks if an existing household has 2 adults of different gender
+(1 male, 1 female). Only under this condition reproduction is possible and a
+3rd person may be added to it (after about 260-280 days). Adoption is not yet
+simulated and may not be added. Please note that this is a city growth
+simulation and not a social simulation.
+
 [EOF]