getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n",
__CLASS__,
__LINE__
));
}
// Set description
$this->setPartDescr("Werft");
// Staff-Liste/Schiffstyp-Liste erzeugen
$this->createStaffList();
$this->createShipTypeList();
// Generate unique ID number
$this->createUniqueID();
}
// Create a shipyard and notify it about it's owner
public static 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 final static function createShipyard (Harbor $harborInstance, $shipyardName) {
// Instanz temporaer holen
$shipyardInstance = new Shipyard();
// Debug message
if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Werft mit dem Namen %s wird im Hafen %s konstruiert.
\n",
__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);
// Etwas aufraeumen
$shipyardInstance->removeDraught();
$shipyardInstance->removeSystemArray();
// Debug-Meldung
if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s wurde gebaut.
\n",
__CLASS__,
__LINE__,
$shipyardName
));
// Instanz zurueckliefern
return $shipyardInstance;
}
// Create staff list
private function createStaffList () {
if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s erhält eine Arbeiterliste.
\n",
__CLASS__,
__LINE__,
$this->getShipyardName()
));
$this->staffList = new FrameworkArrayObject();
}
// Create ship type list
private function createShipTypeList () {
if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s erhält eine Typenliste.
\n",
__CLASS__,
__LINE__,
$this->getShipyardName()
));
$this->shipTypeList = new FrameworkArrayObject();
}
// Setter-Methode fuer Werft-Name
public function setShipyardName ($shipyardName) {
$this->shipyardName = (string) $shipyardName;
}
// Getter-Methode fuer Werft-Name
public function getShipyardName () {
return $this->shipyardName;
}
// Setter-Methode fuer Hafen-Instanz
public function setHarborInstance (Harbor $harborInstance) {
$this->harborInstance = $harborInstance;
}
// Getter-Methode fuer Hafen-Instanz
public function getHarborInstance () {
return $this->harborInstance;
}
// Setter fuer Reederei-Instanz
public function setCompanyInstance (ShippingCompany $companyInstance) {
$this->shippingCompany = $companyInstance;
}
// Getter fuer Reederei-Instanz
public function getCompanyInstance () {
return $this->shippingCompany;
}
// Add new personell
public function addNewPersonell ($personell) {
if (is_null($this->staffList)) {
// Opps, not initialized!
ApplicationEntryPoint::app_die("New personell:
".print_r($this, true).""); } // 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->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s kann bald Schiffe vom Typ %s bauen.