X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=application%2Fship-simu%2Fmain%2Fships%2Fclass_BaseShip.php;h=bdebb6862d79fdb085ace13b79418d0db890d9d2;hp=36863fe3a7762b98731d0749752d46daf9131bcb;hb=ec23e72b16433ac136817f3ea78697fb70236e4a;hpb=d527a312ec4b2983fc0ecda2179ce335c1a5a1f9
diff --git a/application/ship-simu/main/ships/class_BaseShip.php b/application/ship-simu/main/ships/class_BaseShip.php
index 36863fe..bdebb68 100644
--- a/application/ship-simu/main/ships/class_BaseShip.php
+++ b/application/ship-simu/main/ships/class_BaseShip.php
@@ -42,15 +42,11 @@ class BaseShip extends BaseSimulator {
// Call parent constructor
parent::__construct($className);
- // Set object description
- $this->setObjectDescription("Allgemeines Schiff");
-
// Prepare array object for all structures
$this->createStructuresArray();
// Clean-up a little
$this->removePartInstance();
- $this->removeNumberFormaters();
}
// Array-Objekt anlegen
@@ -62,7 +58,7 @@ class BaseShip extends BaseSimulator {
// buildInstance = Das was in das Schiffsteil evtl. eingebaut werden soll (null = kein besonderes Teil einbauen!)
// partClass = Das zu konstruierende Schiffsteil
public function createShipPart (ConstructableShipPart $buildInstance, $partClass) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s erhält ein neues Schiffsteil (%s).",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s erhält ein neues Schiffsteil (%s).",
__CLASS__,
__LINE__,
$this->getShipName(),
@@ -70,19 +66,19 @@ class BaseShip extends BaseSimulator {
));
// Ist die gewuenschte Klasse vorhanden?
- if (class_exists($partClass)) {
- // Get an instance back from our object factory
- $partInstance = ObjectFactory::createObjectByName($partClass);
- } else {
+ if (!class_exists($partClass)) {
// Nicht vorhanden, dann Ausnahme werfen!
throw new ClassNotFoundException($partClass, self::EXCEPTION_CLASS_NOT_FOUND);
- }
+ } // END - if
+
+ // Get an instance back from our object factory
+ $partInstance = ObjectFactory::createObjectByName($partClass);
// Das Einbauen versuchen...
try {
$partInstance->addShipPartToShip($this, $buildInstance);
} catch (MotorShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keinen Motor erhalten! Grund: %s",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keinen Motor erhalten! Grund: %s",
__CLASS__,
__LINE__,
$this->getShipName(),
@@ -90,7 +86,7 @@ class BaseShip extends BaseSimulator {
));
return false;
} catch (RoomShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keinen Maschinenraum erhalten! Grund: %s",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keinen Maschinenraum erhalten! Grund: %s",
__CLASS__,
__LINE__,
$this->getShipName(),
@@ -99,7 +95,7 @@ class BaseShip extends BaseSimulator {
return false;
} catch (StructureShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keine Aufbauten erhalten! Grund: %s",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keine Aufbauten erhalten! Grund: %s",
__CLASS__,
__LINE__,
$this->getShipName(),
@@ -107,7 +103,7 @@ class BaseShip extends BaseSimulator {
));
return false;
} catch (CabinShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keine Kabine erhalten! Grund: %s",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keine Kabine erhalten! Grund: %s",
__CLASS__,
__LINE__,
$this->getShipName(),
@@ -115,7 +111,7 @@ class BaseShip extends BaseSimulator {
));
return false;
} catch (DeckShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat kein Deck erhalten! Grund: %s",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat kein Deck erhalten! Grund: %s",
__CLASS__,
__LINE__,
$this->getShipName(),
@@ -127,14 +123,6 @@ class BaseShip extends BaseSimulator {
// Instanz im Aufbauten-Array vermerken
$this->structures->append($partInstance);
- // Debug-Meldung ausgeben
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat das Schiffsteil %s eingebaut bekommen.",
- __CLASS__,
- __LINE__,
- $this->getShipName(),
- $partInstance->getObjectDescription()
- ));
-
// Alles klar!
return true;
}