Index: code/trunk/src/modules/objects/triggers/Trigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/Trigger.cc	(revision 7284)
+++ code/trunk/src/modules/objects/triggers/Trigger.cc	(revision 7601)
@@ -26,4 +26,10 @@
  *
  */
+
+/**
+    @file Trigger.cc
+    @brief Implementation of the Trigger class.
+    @ingroup NormalTrigger
+*/
 
 #include "Trigger.h"
@@ -42,22 +48,14 @@
   CreateFactory(Trigger);
 
-  Trigger::Trigger(BaseObject* creator) : StaticEntity(creator)
+  Trigger::Trigger(BaseObject* creator) : TriggerBase(creator)
   {
     RegisterObject(Trigger);
 
-    this->mode_ = TriggerMode::EventTriggerAND;
-
-    this->bFirstTick_ = true;
     this->bActive_ = false;
     this->bTriggered_ = false;
     this->latestState_ = 0x0;
 
-    this->bInvertMode_ = false;
-    this->bSwitch_ = false;
-    this->bStayActive_ = false;
-    this->delay_ = 0.0f;
     this->remainingTime_ = 0.0f;
     this->timeSinceLastEvent_ = 0.0f;
-    this->remainingActivations_ = -1;
 
 //    this->bUpdating_ = false;
@@ -82,18 +80,9 @@
   {
     SUPER(Trigger, XMLPort, xmlelement, mode);
-
-    XMLPortParam(Trigger, "delay",       setDelay,       getDelay,       xmlelement, mode).defaultValues(0.0f);
-    XMLPortParam(Trigger, "switch",      setSwitch,      getSwitch,      xmlelement, mode).defaultValues(false);
-    XMLPortParam(Trigger, "stayactive",  setStayActive,  getStayActive,  xmlelement, mode).defaultValues(false);
-    XMLPortParam(Trigger, "activations", setActivations, getActivations, xmlelement, mode).defaultValues(-1);
-    XMLPortParam(Trigger, "invert",      setInvert,      getInvert,      xmlelement, mode).defaultValues(false);
-    XMLPortParamTemplate(Trigger, "mode", setMode, getModeString, xmlelement, mode, const std::string&).defaultValues("or");
-
-    XMLPortObject(Trigger, Trigger, "", addTrigger, getTrigger, xmlelement, mode);
   }
 
   void Trigger::tick(float dt)
   {
-    if (this->bFirstTick_)
+    if(this->bFirstTick_)
     {
       this->bFirstTick_ = false;
@@ -107,5 +96,5 @@
     SUPER(Trigger, tick, dt);
 
-    bool newTriggered = this->isTriggered() ^ this->bInvertMode_;
+    bool newTriggered = this->isTriggered() ^ this->getInvert();
 
     // check if new triggering event is really new
@@ -121,5 +110,5 @@
       {
         this->latestState_ &= 0xFE; // set trigger bit to 0
-        if (!this->bSwitch_)
+        if (!this->getSwitch())
           this->switchState();
       }
@@ -145,5 +134,5 @@
         this->remainingTime_ = this->stateChanges_.front().first;
       else
-        this->timeSinceLastEvent_ = this->delay_;
+        this->timeSinceLastEvent_ = this->getDelay();
     }
 
@@ -197,5 +186,5 @@
   bool Trigger::checkAnd()
   {
-    std::set<Trigger*>::iterator it;
+    std::set<TriggerBase*>::iterator it;
     for(it = this->children_.begin(); it != this->children_.end(); ++it)
     {
@@ -208,5 +197,5 @@
   bool Trigger::checkOr()
   {
-    std::set<Trigger*>::iterator it;
+    std::set<TriggerBase*>::iterator it;
     for(it = this->children_.begin(); it != this->children_.end(); ++it)
     {
@@ -219,5 +208,5 @@
   bool Trigger::checkXor()
   {
-    std::set<Trigger*>::iterator it;
+    std::set<TriggerBase*>::iterator it;
     bool test = false;
     for(it = this->children_.begin(); it != this->children_.end(); ++it)
@@ -233,6 +222,6 @@
   bool Trigger::switchState()
   {
-    if (( (this->latestState_ & 2) && this->bStayActive_ && (this->remainingActivations_ <= 0))
-     || (!(this->latestState_ & 2)                       && (this->remainingActivations_ == 0)))
+    if (( (this->latestState_ & 2) && this->getStayActive() && (this->remainingActivations_ <= 0))
+     || (!(this->latestState_ & 2)                          && (this->remainingActivations_ == 0)))
       return false;
     else
@@ -261,50 +250,7 @@
   }
 
-  void Trigger::setDelay(float delay)
-  {
-    this->delay_ = delay;
-    this->timeSinceLastEvent_ = delay;
-  }
-
-  void Trigger::setMode(const std::string& modeName)
-  {
-    if (modeName == "and")
-      this->setMode(TriggerMode::EventTriggerAND);
-    else if (modeName == "or")
-      this->setMode(TriggerMode::EventTriggerOR);
-    else if (modeName == "xor")
-      this->setMode(TriggerMode::EventTriggerXOR);
-  }
-
-  std::string Trigger::getModeString() const
-  {
-    if (this->mode_ == TriggerMode::EventTriggerAND)
-      return "and";
-    else if (this->mode_ == TriggerMode::EventTriggerOR)
-      return "or";
-    else if (this->mode_ == TriggerMode::EventTriggerXOR)
-      return "xor";
-    else
-      return "and";
-  }
-
-  void Trigger::addTrigger(Trigger* trigger)
-  {
-    if (this != trigger)
-      this->children_.insert(trigger);
-  }
-
-  const Trigger* Trigger::getTrigger(unsigned int index) const
-  {
-    if (this->children_.size() <= index)
-      return NULL;
-
-    std::set<Trigger*>::const_iterator it;
-    it = this->children_.begin();
-
-    for (unsigned int i = 0; i != index; ++i)
-      ++it;
-
-    return (*it);
+  void Trigger::delayChanged(void)
+  {
+    this->timeSinceLastEvent_ = this->getDelay();
   }
 
