]> git.mxchange.org Git - city.git/blobdiff - application/city/main/city/class_BaseCity.php
Renamed exception (in 'core') + updated 'core'.
[city.git] / application / city / main / city / class_BaseCity.php
index fb83ddb1dae667406707b26209ab0cae93b207bc..e6243f5d8114f40dc8b283fd30b7cf728e5dd878 100644 (file)
@@ -80,8 +80,8 @@ class BaseCity extends BaseCitySystem implements Updateable, AddableCriteria {
 
                // Output all lines
                self::createDebugInstance(__CLASS__)->debugOutput(' ');
-               self::createDebugInstance(__CLASS__)->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' mode active');
-               self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 City Developer Team');
+               self::createDebugInstance(__CLASS__)->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' daemon starting');
+               self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2015 City Developer Team');
                self::createDebugInstance(__CLASS__)->debugOutput(' ');
                self::createDebugInstance(__CLASS__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.');
                self::createDebugInstance(__CLASS__)->debugOutput('This is free software, and you are welcome to redistribute it under certain');
@@ -101,7 +101,7 @@ class BaseCity extends BaseCitySystem implements Updateable, AddableCriteria {
                assert($requestInstance instanceof Requestable);
 
                // Add City number and type
-               $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NR  , 1);
+               $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID  , 1);
                $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode'));
 
                // Add the City id
@@ -169,22 +169,19 @@ class BaseCity extends BaseCitySystem implements Updateable, AddableCriteria {
         * @return      void
         */
        public function activateCity (Requestable $requestInstance, Responseable $responseInstance) {
-               // Checks whether a listener is still active and shuts it down if one
-               // is still listening.
-               if (($this->determineIfListenerIsActive()) && ($this->isCityActive())) {
-                       // Shutdown them down before they can hurt anything
-                       $this->shutdownListenerPool();
-               } // END - if
-
                // Get the controller here
                $controllerInstance = Registry::getRegistry()->getInstance('controller');
 
                // Run all filters for the City activation
                $controllerInstance->executeActivationFilters($requestInstance, $responseInstance);
 
+               // Make sure the city's state is 'virigin'
+               assert($this->getStateInstance()->validateCityStateIsVirgin() === TRUE);
+
                // ----------------------- Last step from here ------------------------
                // Activate the City. This is ALWAYS the last step in this method
-               $this->getStateInstance()->CityIsActivated();
+               /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY[' . __METHOD__ . ':' . __LINE__ . ']: state=' . $this->getStateInstance()->__toString());
+               $this->getStateInstance()->citySimulationIsActivated();
                // ---------------------- Last step until here ------------------------
        }
 
@@ -225,16 +222,16 @@ class BaseCity extends BaseCitySystem implements Updateable, AddableCriteria {
         * @param       $CityData                       An array with valid City data
         * @return      void
         */
-       public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $CityData) {
+       public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $cityData) {
                // Add all data the array provides
-               foreach (CityDistributedHashTableDatabaseWrapper::getAllElements() as $element) {
+               foreach (CityInformationDatabaseWrapper::getAllElements() as $element) {
                        // Is the element there?
-                       if (isset($CityData[$element])) {
+                       if (isset($cityData[$element])) {
                                // Add it
-                               $dataSetInstance->addCriteria($element, $CityData[$element]);
+                               $dataSetInstance->addCriteria($element, $cityData[$element]);
                        } else {
                                // Output warning message
-                               /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('City[' . __METHOD__ . ':' . __LINE__ . ']: addArrayToDataSet(): Element ' . $element . ' not found in CityData array.');
+                               /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY[' . __METHOD__ . ':' . __LINE__ . ']: addArrayToDataSet(): Element ' . $element . ' not found in CityData array.');
                        }
                } // END - foreac
        }