X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=application%2Fship-simu%2Fmain%2Fconstructions%2Fharbors%2Fclass_Harbor.php;h=9cae1be691cea0e1872c00167caa65adb37861bc;hp=2dd43ea568e817e1fa5c65f019775de5f7bfdf5e;hb=efba981c9bf18c733dfde945b09111ff4b6007ce;hpb=edc57038a9262e3a04572e0d9036a9f745b10fb7 diff --git a/application/ship-simu/main/constructions/harbors/class_Harbor.php b/application/ship-simu/main/constructions/harbors/class_Harbor.php index 2dd43ea..9cae1be 100644 --- a/application/ship-simu/main/constructions/harbors/class_Harbor.php +++ b/application/ship-simu/main/constructions/harbors/class_Harbor.php @@ -1,11 +1,31 @@ + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @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 . + */ class Harbor extends BaseConstruction { // Namen des Hafens (z.B. Hamburger Hafen) private $harborName = "Unbekannter Hafen"; - //�Schiffsliste aller gebauten Schiffe + // Schiffsliste aller gebauten Schiffe private $constructedShips = null; // Liegeplatz-Liste @@ -15,18 +35,15 @@ class Harbor extends BaseConstruction { private $shipyardList = null; // Constructor - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[Harbor:] Konstruktor erreicht.
\n"); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Hafen"); + $this->setObjectDescription("Hafen"); // Generate unique ID number - $this->createUniqueID(); + $this->generateUniqueId(); // Clean up a little $this->removeSystemArray(); @@ -34,82 +51,46 @@ class Harbor extends BaseConstruction { } // Creates a harbor - public static function createHarbor ($harborName) { + public final static function createHarbor ($harborName) { // Hafen-Instanz holen $harborInstance = new Harbor(); - // Debug message - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $harborInstance->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen %s wird konstruiert.
\n", $harborName)); - // Hafenname setzen $harborInstance->setHarborName($harborName); // Werftliste initialisieren $harborInstance->createshipyardList(); - // Debug-Meldung ausgeben - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $harborInstance->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen %s ist jetzt fertig gebaut.
\n", $harborName)); - // Instanz zurueckliefern return $harborInstance; } // Werft-Liste generieren public function createshipyardList () { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Werft-Liste wird für den Hafen %s erstellt.
\n", - $this->getHarborName() - )); - $this->shipyardList = new FrameworkArrayObject(); + $this->shipyardList = new FrameworkArrayObject("FakedShipyardList"); } // Setter fuer Hafennamen - public function setHarborName ($harborName) { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen heisst jetzt %s.
\n", $harborName)); + public final function setHarborName ($harborName) { $this->harborName = (string) $harborName; } // Getter fuer Hafennamen - public function getHarborName () { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Hafenname %s wurde angefordert.
\n", $this->harborName)); + public final function getHarborName () { return $this->harborName; } // Werft in den Hafen einbauen und Werft->Reederei zuweisen public function addNewShipyardNotify ($shipyardName, ShippingCompany $companyInstance) { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Die Werft %s wird im Hafen %s gebaut.
\n", - $shipyardName, $this->getHarborName() - )); - // Werft generieren und in die Werftliste aufnehmen $this->shipyardList->append(Shipyard::createShipyardNotify($this, $shipyardName, $companyInstance)); } // Werft in den Hafen einbauen ohne Zuweisung einer Reederei (gehoert der "Stadt" dann) public function addNewShipyard ($shipyardName) { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Die Werft %s wird im Hafen %s gebaut.
\n", - $shipyardName, $this->getHarborName() - )); - // Werft generieren und in die Werftliste aufnehmen $this->shipyardList->append(Shipyard::createShipyard($this, $shipyardName)); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF]