Updated 'core'.
[shipsimu.git] / application / shipsimu / main / constructions / harbors / class_Harbor.php
1 <?php
2 /**
3  * A harbor class suitable for all kind of harbors
4  *
5  * @author              Roland Haeder <webmaster@shipsimu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.shipsimu.org
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 class Harbor extends BaseConstruction {
25         // Namen des Hafens (z.B. Hamburger Hafen)
26         private $harborName = "Unbekannter Hafen";
27
28         // Schiffsliste aller gebauten Schiffe
29         private $constructedShips = null;
30
31         // Liegeplatz-Liste
32         private $berthList = null;
33
34         // List of all assigned shipyards
35         private $shipyardList = null;
36
37         // Constructor
38         protected function __construct () {
39                 // Call parent constructor
40                 parent::__construct(__CLASS__);
41         }
42
43         // Creates a harbor
44         public static final function createHarbor ($harborName) {
45                 // Hafen-Instanz holen
46                 $harborInstance = new Harbor();
47
48                 // Hafenname setzen
49                 $harborInstance->setHarborName($harborName);
50
51                 // Werftliste initialisieren
52                 $harborInstance->createshipyardList();
53
54                 // Instanz zurueckliefern
55                 return $harborInstance;
56         }
57
58         // Werft-Liste generieren
59         public function createshipyardList () {
60                 $this->shipyardList = new FrameworkArrayObject("FakedShipyardList");
61         }
62
63         // Setter fuer Hafennamen
64         public final function setHarborName ($harborName) {
65                 $this->harborName = (string) $harborName;
66         }
67
68         // Getter fuer Hafennamen
69         public final function getHarborName () {
70                 return $this->harborName;
71         }
72
73         // Werft in den Hafen einbauen und Werft->Reederei zuweisen
74         public function addNewShipyardNotify ($shipyardName, ShippingCompany $companyInstance) {
75                 // Werft generieren und in die Werftliste aufnehmen
76                 $this->shipyardList->append(Shipyard::createShipyardNotify($this, $shipyardName, $companyInstance));
77         }
78
79         // Werft in den Hafen einbauen ohne Zuweisung einer Reederei (gehoert der "Stadt" dann)
80         public function addNewShipyard ($shipyardName) {
81                 // Werft generieren und in die Werftliste aufnehmen
82                 $this->shipyardList->append(Shipyard::createShipyard($this, $shipyardName));
83         }
84 }
85
86 // [EOF]
87 ?>