+++ /dev/null
-<?php
-// Change directory
-@chdir("../..");
-
-// Set testing mode (no starter.php will be loaded!)
-define('TEST_MODE', true);
-
-// Load config file
-require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
-
-// Load all include files
-require(PATH . "inc/includes.php");
-
-// Load all game classes
-require(PATH . "inc/classes.php");
-
-// Load file I/O handler
-require(PATH . "inc/file_io.php");
-
-// Load database layer
-require(PATH . "inc/database.php");
-
-// Set default application
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
-$application = "ship-simu";
-
-// Load more includes
-require(PATH . "application/ship-simu/loader.php");
-
-// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
-// jetzt die Personalliste wiederherstellen
-try {
- $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
-} catch (InvalidIDFormatException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FileIsEmptyException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FilePointerNotOpenedException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidMD5ChecksumException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidDataLengthException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidSimulatorIDException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MismatchingCompressorsException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNullException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNoArrayException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerMaybeDamagedException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("The personal object looks like this:<br />
-<pre>%s</pre>\n",
- print_r($personell, true)
- ));
-}
-
-// Hafen bauen
-$harbor = Harbor::createHarbor("Hamburger Hafen");
-
-// Name ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Der <strong>%s</strong> ist gegründet worden.<br />\n",
- $harbor->getHarborName()
-));
-
-// Hafen-Objekt debuggen
-if (defined('DEBUG_HARBOR_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Der <strong>%s</strong> sieht wie folgt aus:<br />
-<pre>%s</pre>\n",
- $harbor->getHarborName(),
- print_r($harbor, true)
- ));
-}
-
-// Haendler gruenden
-$merchant = Merchant::createMerchant("Namenlos", $harbor);
-
-// Array mit Einbauten erstellen
-$einbauten = array(
- 'parts' => array( // *** Die zu einbauenden Schiffsteile ***
- 'Motor' => array( // --- Maschinenraum mit Motor ---
- "Ocean-Power 2000", // Bezeichnung
- 20000, // Pferdestaerken
- 6, // Anzahl Nocken
- 2.5, 2, 3.5 // Abmasse (Breite/Hoehe/Laenge)
- ),
- 'Bridge' => array( // --- Kommandobruecke ---
- 26, 2.5, 15 // Abmasse (Breite/Hoehe/Laenge)
- ),
- 'CarDeck' => array( // --- Autodecks ---
- 'amount' => 8, // Anzahl Autodecks (einige liegen hintereinander im selben Deck!)
- 'dim' => array( // Abmessung (Breite/Hoehe/Laenge)
- 6, 3, 16
- )
- ),
- 'TruckDeck' => array( // --- Decks fuer LKW/Busse haben vielleicht ein anderes Belueftgungssystem, etc. ---
- 'amount' => 1, // Anzahl der Decks
- 'dim' => array( // Abmessung (Breite/Hoehe/Laenge)
- 8, 5, 195 // Geht durchs gesamte Schiff!
- )
- ),
- 'TrainDeck' => array( // --- Decks fuer Zuege haben Schienen... ---
- 'amount' => 1, // Anzahl der Decks
- 'dim' => array( // Abmessung (Breite/Hoehe/Laenge)
- 8, 4, 195 // Geht durchs gesamte Schiff!
- )
- ),
- 'LuxuryCabin' => array( // --- Luxuskabinen ---
- 'amount' => 20, // Anzahl Luxuskabinen im Schiff
- 'rooms' => 4, // Raeume: 2 Schlafzimmer, 1 Auffenthaltszimmer, 1 Bad mit Dusche/Toilette/Waschbecken
- 'bed' => 3, // Anzahl Betten (1 Doppelbett 2 Einzelbetten, Doppel-/Einzelbetten in getrennte Raeume)
- 'dim' => array( // Abmessung der Luxuskabine (Breite/Hoehe/Laenge)
- 4, 3, 5
- ),
- ),
- 'PremierCabin' => array( // --- Mittlere Kabinen ---
- 'amount' => 40, // Anzahl
- 'rooms' => 2, // Raeume: Schlafzimmer, Bad mit Toilette/Waschbecken
- 'bed' => 2, // Anzahl Betten (1 Doppelbett, 1 Einzelbett; gemeinsamer Raum)
- 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge)
- 4, 2.5, 4
- )
- ),
- 'LowCabin' => array( // --- Untere Kabinen (befinden sich in den Unterbauten) ---
- 'amount' => 90, // Anzahl
- 'rooms' => 1, // Raeume: Schlafzimmer, Waschbecken
- 'bed' => 2, // Anzahl Betten (2 Etagenbetten)
- 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge)
- 3, 2.5, 4
- )
- ),
- 'EconomyCabin' => array( // --- Unterste Kabinen (befinden sich tief unten im Schiffsbauch) ---
- 'amount' => 140, // Anzahl
- 'rooms' => 1, // Raeume: Schlafzimmer, Waschbecken
- 'bed' => 1, // Anzahl Betten (1 Etagenbett)
- 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge)
- 2, 2.5, 2
- )
- )
- ),
- 'builds' => array( // *** Welche Oberklasse verwendet werden sollen ***
- 'Motor' => "MaschineRoom",
- 'Bridge' => "BaseUpperStructure",
- 'LuxuryCabin' => "BaseCabin",
- 'PremierCabin' => "BaseCabin",
- 'LowCabin' => "BaseCabin",
- 'EconomyCabin' => "BaseCabin",
- 'CarDeck' => "BaseDeck",
- 'TrainDeck' => "BaseDeck",
- 'TruckDeck' => "BaseDeck"
- )
-);
-
-// Preisliste auffuellen
-foreach ($einbauten['parts'] as $key=>$part) {
- // Create item array string
- $item = "";
- foreach ($part as $idx=>$itemPart) {
- if (is_string($itemPart)) {
- // String found
- $item .= sprintf("\"%s\", ", $itemPart);
- } elseif (is_int($itemPart)) {
- // Integer found
- $item .= sprintf("%d, ", $itemPart);
- } elseif (is_float($itemPart)) {
- // Float found
- $item .= sprintf("%f, ", $itemPart);
- } elseif (is_array($itemPart)) {
- // Sub-array found
- $item .= "array(";
-
- // Go all items through
- foreach ($itemPart as $idx2=>$subPart) {
- if (is_int($subPart)) {
- // Integer again found
- $item .= sprintf("%d, ", $subPart);
- } elseif (is_float($subPart)) {
- // Float found
- $item .= sprintf("%f, ", $subPart);
- } else {
- // Unsupport part found
- die(sprintf("[Main:] Unsupported sub-array element on pos <strong>%d</strong> in array <strong>%s</strong> found: <u>%s</u>", $idx2, $idx, $subPart));
- }
- }
-
- // Remove trailing comma
- $item = substr($item, 0, -2);
-
- // Add closing bracket
- $item .= "), ";
- } else {
- // Unsupport part found
- die(sprintf("[Main:] Unsupported array element on pos <strong>%d</strong>: <u>%s</u>", $idx, $itemPart));
- }
- }
-
- // Remove trailing comma
- $item = substr($item, 0, -2);
-
- // Random price
- $price = mt_rand(5, 12) * 10000;
-
- // Give it a try...
- try {
- // Generate command for adding objects to a price list
- $eval = sprintf("\$merchant->addItemToPriceList(%s::create%s(%s), %d);",
- $key,
- $key,
- $item,
- $price
- );
-
- // Debug message
- if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) DebugMiddleware::getInstance()->output(sprintf("[Main:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
- htmlentities($eval)
- ));
-
- // Run the constructed command
- eval($eval);
- } catch (ItemNotTradeableException $e) {
- die(sprintf("[Main:] Die Preisliste des Händlers <strong>%s</strong> kann nicht befüllt werden. Grund: <strong>%s</strong><br />\n",
- $merchant->getMerchantName(),
- $e->getMessage()
- ));
- }
-}
-
-// Haendler-Objekt debuggen
-if (defined('DEBUG_MERCHANT_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Der Händler <strong>%s</strong> sieht wie folgt aus:<br />
-<pre>%s</pre>\n",
- $merchant->getMerchantName(),
- print_r($merchant, true)
- ));
-}
-
-// Reederei gruenden
-$shipping = ShippingCompany::createShippingCompany("Hanseatic Travel Company", $harbor);
-
-// Firmenschef setzen
-try {
- $shipping->setCompanyFounder(CompanyEmployee::createCompanyEmployee("Roland", "Häder", "M", 1977, 9, 26, true, 2000));
-} catch (BirthdayInvalidException $e) {
- die(sprintf("[Main:] Reederei-Gründer konnte nicht gesetzt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Dann mal ausgeben...
-DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> ist von <strong>%s %s</strong> gegründet worden.<br />\n",
- $shipping->getCompanyName(),
- $shipping->getFounderInstance()->getSurname(),
- $shipping->getFounderInstance()->getFamily()
-));
-
-// Die Reederei stellt Personal ein und bedient sich an der $personell-Instanz
-try {
- $shipping->recruitRandomEmployees(10, $personell);
-} catch (ToMuchEmployeesException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal einstellen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (OutOfBoundsException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal einstellen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Anzahl Personal ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat nun <strong>%d</strong> weitere Mitarbeiter.<br />\n",
- $shipping->getCompanyName(),
- $shipping->getTotalEmployee()
-));
-
-// Dann die ersten 3 Werften in den Hafen einbauen und Personal zuweisen
-$shipping->createShipyardInHarbor("Werft 1", $harbor);
-$shipping->createShipyardInHarbor("Werft 2", $harbor);
-$shipping->createShipyardInHarbor("Werft 3", $harbor);
-
-// In alle Werften sollen Passagierschiffe gebaut werden koennen
-try {
- $shipping->addShipTypeToAllShipyards("PassengerShip");
-} catch (ClassNotFoundException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (ClassMismatchException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Personal auf die Werften verteilen
-try {
- $shipping->distributeAllPersonellOnShipyards();
-} catch (NoShipyardsConstructedException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (ClassMismatchException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Normale Meldung ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> beschäftigt nun ihre <strong>%d</strong> Mitarbeiter in <strong>%d</strong> Werft(en):<br />\n",
- $shipping->getCompanyName(),
- $shipping->getTotalEmployee(),
- $shipping->getTotalShipyards()
-));
-
-// Dann nimmt die Reederei ihren ersten Bauauftrag entgegen.
-// Sie muss auch sich selber Bauauftraege erteilen!
-try {
- $shipping->addNewWorksContract(WorksContract::createWorksContract("PassengerShip", "M/S Poseidon", $shipping));
-} catch (ClassNotFoundException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (EmptyStructuresListException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Auftrag-Instanz holen
-$contract = $shipping->getLastContractInstance();
-
-// Die Reederei hat einen Haendler gewaehlt
-try {
- $shipping->setMerchantInstance($merchant);
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Der Händler <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\n",
- $merchant->getMerchantName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Der Händler <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\n",
- $merchant->getMerchantName(),
- $e->getMessage()
- ));
-} catch (ClassMismatchException $e) {
- die(sprintf("[Main:] Der Händler <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\n",
- $merchant->getMerchantName(),
- $e->getMessage()
- ));
-}
-
-// Den Bauauftrag mit der Reederei abgleichen, ob sie den Schiffstyp bauen koennen
-try {
- $typeValid = $shipping->validateWorksContractShipType($contract);
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht validieren. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht validieren. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Kann gebaut werden?
-if ($typeValid) {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> kann Schiffe vom Typ <strong>%s</strong> bauen.<br />\n",
- $shipping->getCompanyName(),
- $contract->getShipInstance()->getObjectDescription()
- ));
-} else {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> kann keine Schiffe vom Typ <strong>%s</strong> bauen!<br />\n",
- $shipping->getCompanyName(),
- $contract->getShipInstance()->getObjectDescription()
- ));
- exit;
-}
-
-// Dann den Bauauftrag verfeinern
-foreach ($einbauten['parts'] as $key=>$part) {
- try {
- $contract->addContractDetails($key, $einbauten['builds'][$key], $part);
- } catch (ShipPartNotConstructableException $e) {
- // Output message
- die($e->getMessage());
- } catch (ShipNotConstructedException $e) {
- // Output message
- die($e->getMessage());
- } catch (ItemNotInPriceListException $e) {
- die(sprintf("[Main:] Der Artikel <strong>%s</strong> konnte nicht in der Preisliste gefunden werden. Grund: <strong>%s</strong><br />\n",
- $key,
- $e->getMessage()
- ));
- } catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Der Artikel <strong>%s</strong> konnte nicht in der Preisliste gefunden werden. Grund: <strong>%s</strong><br />\n",
- $key,
- $e->getMessage()
- ));
- }
-}
-
-// Reederei-Objekt ausgeben
-if (defined('DEBUG_COMPANY_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> sieht wie folgt aus:<br />
-<pre>%s</pre>\n",
- $shipping->getCompanyName(),
- print_r($shipping, true)
- ));
-}
-
-// Clean up a little
-unset($einbauten);
-unset($part);
-unset($eval);
-unset($item);
-unset($key);
-unset($typeValid);
-
-// Gesamtwert ausgeben
-try {
- $totalValue = $contract->getTotalPrice();
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (EmptyStructuresListException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (TotalPriceNotCalculatedException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Wert ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Der Bau der <strong>%s</strong> wird der Reederei <strong>%s</strong> voraussichtlich <strong>%s</strong> kosten.<br />\n",
- $contract->getShipInstance()->getShipName(),
- $shipping->getCompanyName(),
- $contract->formatCurrency($totalValue)
-));
-
-// Clean up a little
-unset($totalValue);
-
-// Den Bauvertrag unterschreiben (damit wird er in den Bau-Queue aufgenommen)
-try {
- $shipping->signContract($contract, $shipping);
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (InvalidContractPartnerException $e) {
- die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (ContractAllreadySignedException $e) {
- die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (WrongContractPartnerException $e) {
- die(sprintf("[Main:] The shipping company <strong>%s</strong> was not able to sign the contract for the following reason: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Meldung ausgeben
-if ($contract->isSigned()) {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat den Bau der <strong>%s</strong> zugestimmt.<br />\n",
- $shipping->getCompanyName(),
- $contract->getShipInstance()->getShipName()
- ));
-} else {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat den Bau der <strong>%s</strong> abgelehnt.<br />\n",
- $shipping->getCompanyName(),
- $contract->getShipInstance()->getShipName()
- ));
- exit;
-}
-
-// Auftrag-Objekt ausgeben
-if (defined('DEBUG_CONTRACT_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Der Bauauftrag sieht wie folgt aus:<br />
-<pre>%s</pre>\n",
- print_r($contract, true)
- ));
-}
-
-// Erstmal bis hier hin...
-//exit();
-
-// Anzahl Betten ermitteln
-try {
- $totalBeds = $contract->getShipInstance()->calcTotalBeds();
-} catch (StructuresOutOfBoundsException $e) {
- die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (EmptyStructuresListException $e) {
- die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Bettenanzahl ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Es stehen <strong>%d</strong> Betten zur Verfügung.",
- $totalBeds
-));
-
-//
-?>
+++ /dev/null
-<?php
-// Change directory
-@chdir("../..");
-
-// Set testing mode (no starter.php will be loaded!)
-define('TEST_MODE', true);
-
-// Load config file
-require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
-
-// Load all include files
-require(PATH . "inc/includes.php");
-
-// Load all game classes
-require(PATH . "inc/classes.php");
-
-// Load file I/O handler
-require(PATH . "inc/file_io.php");
-
-// Load database layer
-require(PATH . "inc/database.php");
-
-// Set default application
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
-$application = "ship-simu";
-
-// Load more includes
-require(PATH . "application/ship-simu/loader.php");
-
-// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
-// jetzt die Personalliste wiederherstellen
-try {
- $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
-} catch (InvalidIDFormatException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FileIsEmptyException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FilePointerNotOpenedException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidMD5ChecksumException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidDataLengthException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidSimulatorIDException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MismatchingCompressorsException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNullException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNoArrayException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerMaybeDamagedException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("The personal object looks like this:<br />
-<pre>%s</pre>\n",
- print_r($personell, true)
- ));
-}
-
-// Erstmal bis hier hin
-exit();
-
-// Etwas zum Testen...
-try {
- $personell = SimulatorPersonell::createSimulatorPersonell(20);
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Personal list not created for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Personal list not created for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Personal list not created for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("The personal object looks like this:<br />
-<pre>%s</pre>\n",
- print_r($personell, true)
- ));
-}
-
-// Try to save the object (for testing purposes)
-try {
- $personell->saveObjectToDatabase();
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidObjectException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (UnsupportedLimitationPartException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (GetterNotFoundException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoArrayCreatedException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-//
-?>
+++ /dev/null
-<?php
-// Change directory
-@chdir("../..");
-
-// Set testing mode (no starter.php will be loaded!)
-define('TEST_MODE', true);
-
-// Load config file
-require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
-
-// Load all include files
-require(PATH . "inc/includes.php");
-
-// Load all game classes
-require(PATH . "inc/classes.php");
-
-// Load file I/O handler
-require(PATH . "inc/file_io.php");
-
-// Load database layer
-require(PATH . "inc/database.php");
-
-// Set default application
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
-$application = "ship-simu";
-
-// Load more includes
-require(PATH . "application/ship-simu/loader.php");
-
-// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
-// jetzt die Personalliste wiederherstellen
-try {
- $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
-} catch (InvalidIDFormatException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FileIsEmptyException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FilePointerNotOpenedException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidMD5ChecksumException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidDataLengthException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidSimulatorIDException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MismatchingCompressorsException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNullException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNoArrayException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerMaybeDamagedException $e) {
- die(sprintf("[Main:] Could not create personal list for follwing reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- echo sprintf("The personal object looks like this:<br />
-<pre>%s</pre>\n",
- print_r($personell, true)
- );
-}
-
-// Erstmal bis hier hin
-exit();
-
-// Etwas zum Testen...
-try {
- $personell = SimulatorPersonell::createSimulatorPersonell(20);
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Personal list not created for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Personal list not created for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Personal list not created for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- echo sprintf("The personal object looks like this:<br />
-<pre>%s</pre>\n",
- print_r($personell, true)
- );
-}
-
-// Try to save the object (for testing purposes)
-try {
- $personell->saveObjectToDatabase();
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidObjectException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (UnsupportedLimitationPartException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (GetterNotFoundException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoArrayCreatedException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Object not saved for following reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-//
-?>