X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=application%2Fshipsimu%2Fmain%2Fconstructions%2Fyards%2Fclass_Shipyard.php;fp=application%2Fshipsimu%2Fmain%2Fconstructions%2Fyards%2Fclass_Shipyard.php;h=0000000000000000000000000000000000000000;hp=1959f836dc2e0906d54f2868d8f6113b5cdb1ce3;hb=bacc5f4ac0c29e8d038e8cb3938eab902f9e96ca;hpb=c05766cedd51503851746bbb7b5fb8d2f3e87a74 diff --git a/application/shipsimu/main/constructions/yards/class_Shipyard.php b/application/shipsimu/main/constructions/yards/class_Shipyard.php deleted file mode 100644 index 1959f83..0000000 --- a/application/shipsimu/main/constructions/yards/class_Shipyard.php +++ /dev/null @@ -1,215 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 Shipyard extends BaseConstruction { - // Werft-Name - private $shipyardName = "Namenlose Werft"; - - // Arbeiter-Liste - private $staffList = null; - - // Queue-Liste fuer zu bauende Schiffe - private $queueList = null; - - // Aktuell im Bau befindliches Schiff - private $currShipInConst = null; - - // Liste konstruierbarer Schiffstypen - private $shipTypeList = null; - - // Zugewiesener Hafen - private $harborInstance = null; - - // Zugewiesene Reederei - private $shippingCompany = null; - - // Constructor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Staff-Liste/Schiffstyp-Liste erzeugen - $this->createStaffList(); - $this->createShipTypeList(); - } - - // Create a shipyard and notify it about it's owner - public static final function createShipyardNotify (Harbor $harborInstance, $shipyardName, ShippingCompany $companyInstance) { - // Werft-Instanz holen - $shipyardInstance = self::createShipyard($harborInstance, $shipyardName); - - // Reederei der Werft zuweisen - $shipyardInstance->setCompanyInstance($companyInstance); - - // Die Reederei ueber ihre Werft informieren - $companyInstance->addNewShipyard($shipyardInstance); - - // Instanz zurueckgeben - return $shipyardInstance; - } - - // Create a shipyard, first we need to create a harbor - public static final function createShipyard (Harbor $harborInstance, $shipyardName) { - // Instanz temporaer holen - $shipyardInstance = new Shipyard(); - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->debugOutput(sprintf("[%s:%d] Eine Werft mit dem Namen %s wird im Hafen %s konstruiert.", - __CLASS__, - __LINE__, - $shipyardName, - $harborInstance->getHarborName() - )); - - // Werft-Name setzen - $shipyardInstance->setShipyardName($shipyardName); - - // Hafen-Instanz setzen - $shipyardInstance->setHarborInstance($harborInstance); - - // Abmasse setzen in Meter - $shipyardInstance->setWidth(30); - $shipyardInstance->setHeight(30); - $shipyardInstance->setLength(100); - - // Clean up a little - $shipyardInstance->removeDraught(); - - // Debug-Meldung - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->debugOutput(sprintf("[%s:%d] Die Werft %s wurde gebaut.", - __CLASS__, - __LINE__, - $shipyardName - )); - - // Instanz zurueckliefern - return $shipyardInstance; - } - - // Create staff list - private function createStaffList () { - $this->staffList = new FrameworkArrayObject("FakedStaffList"); - } - - // Create ship type list - private function createShipTypeList () { - $this->shipTypeList = new FrameworkArrayObject("FakedShipTypeList"); - } - - // Setter-Methode fuer Werft-Name - public final function setShipyardName ($shipyardName) { - $this->shipyardName = (string) $shipyardName; - } - - // Getter-Methode fuer Werft-Name - public final function getShipyardName () { - return $this->shipyardName; - } - - // Setter-Methode fuer Hafen-Instanz - public final function setHarborInstance (Harbor $harborInstance) { - $this->harborInstance = $harborInstance; - } - - // Getter-Methode fuer Hafen-Instanz - public final function getHarborInstance () { - return $this->harborInstance; - } - - // Setter fuer Reederei-Instanz - public final function setCompanyInstance (ShippingCompany $companyInstance) { - $this->shippingCompany = $companyInstance; - } - - // Getter fuer Reederei-Instanz - public final function getCompanyInstance () { - return $this->shippingCompany; - } - - // Add new personell - public function addNewPersonell ($personell) { - // Add to list - $this->staffList->append($personell); - } - - // Add a new ship type to our list - public function addNewConstructableShipType ($shipType) { - // This must be a string! - $shipType = (string) $shipType; - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s kann bald Schiffe vom Typ %s bauen.", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Add to list - $this->shipTypeList->append($shipType); - } - - // Is the specified ship type in our list? - public function isShipTypeConstructable ($shipType) { - // First we can't build this ship - $result = false; - - // This must be a string! - $shipType = (string) $shipType; - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s prüft, ob Schiffe vom Typ %s baubar sind.", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Iterate through all types - for ($idx = $this->shipTypeList->getIterator(); $idx->valid(); $idx->next()) { - // Get current ship type - $type = (string) $idx->current(); - - // Is both the same? - $result = ($type == $shipType); - - // Type is found? - if ($result) break; // Then abort the search! - } - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s hat die Suche nach dem Schiffstyp %s abgeschlossen.", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Return result - return $result; - } -} - -// [EOF] -?>