7aee583a6e06eaf41aa60f2572f18fc581e86a4f
[shipsimu.git] / application / ship-simu / main / structures / extended / class_BaseDeckStructure.php
1 <?php
2 // Decks (fuer Cargo) allgemein
3 class BaseDeckStructure extends BaseStructure {
4         // Anzahl Decks
5         private $numDecks = 0;
6
7         // Konstruktor
8         private function __construct ($class) {
9                 // Call parent constructor
10                 parent::constructor($class);
11
12                 // Debug message
13                 if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
14                         $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\n",
15                                 __CLASS__,
16                                 __LINE__
17                         ));
18                 }
19
20                 // Set description
21                 $this->setPartDescr("Deckstruktur");
22         }
23
24         // Konstruktor aufrufen
25         public function constructor ($class) {
26                 $this->__construct($class);
27         }
28
29         // Deckstruktur dem Schiff hinzufuegen
30         public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $deckInstance) {
31                 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",
32                         __CLASS__,
33                         __LINE__,
34                         $deckInstance->getPartDescr(),
35                         $shipInstance->getShipName()
36                 ));
37
38                 // Eltern-Methode aufrufen
39                 parent::addShipPartToShip($shipInstance, $deckInstance);
40
41                 // Andere Daten uebertragen und von der Quelle loeschen
42                 $this->setNumDecks($deckInstance->getNumDecks());
43                 $deckInstance->removeNumDecks();
44
45                 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",
46                         __CLASS__,
47                         __LINE__,
48                         $deckInstance->getPartDescr(),
49                         $shipInstance->getShipName()
50                 ));
51         }
52
53         // Deckanzahl entfernen
54         public function removeNumDecks() {
55                 if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gel&ouml;scht.<br />\n",
56                         __CLASS__,
57                         __LINE__
58                 ));
59                 unset($this->numDecks);
60         }
61
62         // Setter-Methode fuer Anzahl Decks
63         public function setNumDecks($numDecks) {
64                 $this->numDecks = (int) $numDecks;
65         }
66
67         // Getter-Methode fuer Anzahl Decks
68         public function getNumDecks() {
69                 return $this->numDecks;
70         }
71 }
72
73 // [EOF]
74 ?>