]> git.mxchange.org Git - shipsimu.git/blobdiff - ship-simu/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php
Initial import of current development status
[shipsimu.git] / ship-simu / application / ship-simu / main / structures / extended / class_BaseDeckStructure.php
diff --git a/ship-simu/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php b/ship-simu/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php
new file mode 100644 (file)
index 0000000..1b225ca
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+// Decks (fuer Cargo) allgemein
+class BaseDeckStructure extends BaseStructure {
+       // Anzahl Decks
+       private $numDecks = 0;
+
+       // Konstruktor
+       private function __construct ($class) {
+               // Eltern-Konstruktor aufrufen
+               parent::constructor($class);
+
+               // Debug message
+               if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+                       $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\n",
+                               __CLASS__,
+                               __LINE__
+                       ));
+               }
+
+               // Beschreibung setzen
+               $this->setPartDescr("Deckstruktur");
+       }
+
+       // Konstruktor aufrufen
+       public function constructor ($class) {
+               $this->__construct($class);
+       }
+
+       // Deckstruktur dem Schiff hinzufuegen
+       public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $deckInstance) {
+               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Deck <strong>%s</strong> wird f&uuml;r das Schiff <strong>%s</strong> konstruiert.<br />\n",
+                       __CLASS__,
+                       __LINE__,
+                       $deckInstance->getPartDescr(),
+                       $shipInstance->getShipName()
+               ));
+
+               // Eltern-Methode aufrufen
+               parent::addShipPartToShip($shipInstance, $deckInstance);
+
+               // Andere Daten uebertragen und von der Quelle loeschen
+               $this->setNumDecks($deckInstance->getNumDecks());
+               $deckInstance->removeNumDecks();
+
+               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Deck <strong>%s</strong> wurde in das Schiff <strong>%s</strong> eingebaut.<br />\n",
+                       __CLASS__,
+                       __LINE__,
+                       $deckInstance->getPartDescr(),
+                       $shipInstance->getShipName()
+               ));
+       }
+
+       // Deckanzahl entfernen
+       public function removeNumDecks() {
+               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gel&ouml;scht.<br />\n",
+                       __CLASS__,
+                       __LINE__
+               ));
+               unset($this->numDecks);
+       }
+
+       // Setter-Methode fuer Anzahl Decks
+       public function setNumDecks($numDecks) {
+               $this->numDecks = (int) $numDecks;
+       }
+
+       // Getter-Methode fuer Anzahl Decks
+       public function getNumDecks() {
+               return $this->numDecks;
+       }
+}
+
+// [EOF]
+?>