X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Ffactories%2Fstates%2Fcruncher%2Fclass_CruncherStateFactory.php;h=8701aa589cea01ad924340e6609809668dafbfd1;hb=86642f37458f91f78f50b5c7f063e737a5c478ce;hp=b67d02ac912923a3b94cd8cbaa032dd6eba43d89;hpb=dfa91e1b5e2d0a3f68c133b3bec4fcb34e5e9c96;p=hub.git diff --git a/application/hub/main/factories/states/cruncher/class_CruncherStateFactory.php b/application/hub/main/factories/states/cruncher/class_CruncherStateFactory.php index b67d02ac9..8701aa589 100644 --- a/application/hub/main/factories/states/cruncher/class_CruncherStateFactory.php +++ b/application/hub/main/factories/states/cruncher/class_CruncherStateFactory.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2011 - 2012 Cruncher Developer Team + * @copyright Copyright (c) 2011 - 2014 Cruncher Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * @@ -36,16 +36,22 @@ class CruncherStateFactory extends ObjectFactory { * Creates an instance of a configurable cruncher state and sets it in the * given cruncher instance. * - * @param $stateName Name of the state + * @param $stateName Name of the state * @param $cruncherInstance A CruncherHelper class instance - * @return $stateInstance A Stateable class instance + * @return $stateInstance A Stateable class instance */ - public static final function createCruncherStateInstanceByName ($stateName, CruncherHelper $cruncherInstance) { + public static final function createCruncherStateInstanceByName ($stateName) { // Then construct the class' configuraton entry $className = 'cruncher_' . $stateName . '_state_class'; + // Get cruncher instance from registry + $cruncherInstance = Registry::getRegistry()->getInstance('cruncher'); + // Get a class from that configuration entry - $stateInstance = self::createObjectByConfiguredName($className, array($cruncherInstance)); + $stateInstance = self::createObjectByConfiguredName($className); + + // Debug message + self::createDebugInstance(__CLASS__)->debugOutput('CRUNCHER-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Cruncher state has changed from ' . $cruncherInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Once we have that state, set it in the cruncher instance $cruncherInstance->setStateInstance($stateInstance);