[Orxonox-commit 2898] r7601 - in code/trunk: doc/api src/modules/objects src/modules/objects/collisionshapes src/modules/objects/eventsystem src/modules/objects/triggers src/orxonox/interfaces

dafrick at orxonox.net dafrick at orxonox.net
Sat Oct 30 13:54:50 CEST 2010


Author: dafrick
Date: 2010-10-30 13:54:49 +0200 (Sat, 30 Oct 2010)
New Revision: 7601

Added:
   code/trunk/src/modules/objects/triggers/TriggerBase.cc
   code/trunk/src/modules/objects/triggers/TriggerBase.h
Modified:
   code/trunk/doc/api/Groups.dox
   code/trunk/src/modules/objects/Attacher.h
   code/trunk/src/modules/objects/ForceField.h
   code/trunk/src/modules/objects/ObjectsPrereqs.h
   code/trunk/src/modules/objects/Planet.h
   code/trunk/src/modules/objects/Script.h
   code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h
   code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h
   code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h
   code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h
   code/trunk/src/modules/objects/eventsystem/EventDispatcher.h
   code/trunk/src/modules/objects/eventsystem/EventFilter.h
   code/trunk/src/modules/objects/eventsystem/EventListener.h
   code/trunk/src/modules/objects/eventsystem/EventName.h
   code/trunk/src/modules/objects/eventsystem/EventTarget.h
   code/trunk/src/modules/objects/triggers/CMakeLists.txt
   code/trunk/src/modules/objects/triggers/CheckPoint.cc
   code/trunk/src/modules/objects/triggers/CheckPoint.h
   code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
   code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
   code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
   code/trunk/src/modules/objects/triggers/DistanceTrigger.h
   code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc
   code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h
   code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc
   code/trunk/src/modules/objects/triggers/EventMultiTrigger.h
   code/trunk/src/modules/objects/triggers/EventTrigger.cc
   code/trunk/src/modules/objects/triggers/EventTrigger.h
   code/trunk/src/modules/objects/triggers/MultiTrigger.cc
   code/trunk/src/modules/objects/triggers/MultiTrigger.h
   code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
   code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h
   code/trunk/src/modules/objects/triggers/Trigger.cc
   code/trunk/src/modules/objects/triggers/Trigger.h
   code/trunk/src/orxonox/interfaces/PlayerTrigger.h
Log:
Adding all classes in modules/objects to Objects module (in doxygen).
Created TriggerBase which is the base class of Trigger and MultiTrigger and now provides the shared functionality and data.
Updated some of the documentation in MultiTrigger and Script.


Modified: code/trunk/doc/api/Groups.dox
===================================================================
--- code/trunk/doc/api/Groups.dox	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/doc/api/Groups.dox	2010-10-30 11:54:49 UTC (rev 7601)
@@ -183,6 +183,21 @@
 /**
     @defgroup Objects Objects
     @ingroup Modules
+
+    @defgroup Collisionshapes Collisionshapes
+    @ingroup Objects
+
+    @defgroup Eventsystem Eventsystem
+    @ingroup Objects
+
+    @defgroup Triggers Triggers
+    @ingroup Objects
+
+    @defgroup NormalTrigger Trigger
+    @ingroup Triggers
+
+    @defgroup MultiTrigger MultiTrigger
+    @ingroup Triggers
 */
 
 /**

Modified: code/trunk/src/modules/objects/Attacher.h
===================================================================
--- code/trunk/src/modules/objects/Attacher.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/Attacher.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file Attacher.h
+    @brief Definition of the Attacher class.
+    @ingroup Objects
+*/
+
 #ifndef _Attacher_H__
 #define _Attacher_H__
 

Modified: code/trunk/src/modules/objects/ForceField.h
===================================================================
--- code/trunk/src/modules/objects/ForceField.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/ForceField.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,11 @@
  *
  */
 
+/**
+    @file ForceField.h
+    @brief Definition of the ForceField class.
+    @ingroup Objects
+*/
 
 #ifndef _ForceField_H__
 #define _ForceField_H__

Modified: code/trunk/src/modules/objects/ObjectsPrereqs.h
===================================================================
--- code/trunk/src/modules/objects/ObjectsPrereqs.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/ObjectsPrereqs.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -92,6 +92,7 @@
     class MultiTrigger;
     class MultiTriggerContainer;
     class Trigger;
+    class TriggerBase;
 }
 
 #endif /* _ObjectsPrereqs_H__ */

Modified: code/trunk/src/modules/objects/Planet.h
===================================================================
--- code/trunk/src/modules/objects/Planet.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/Planet.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file Planet.h
+    @brief Definition of the Planet class.
+    @ingroup Objects
+*/
+
 #ifndef _Planet_H__
 #define _Planet_H__
 

Modified: code/trunk/src/modules/objects/Script.h
===================================================================
--- code/trunk/src/modules/objects/Script.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/Script.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -27,6 +27,12 @@
  *
  */
 
+/**
+    @file Script.h
+    @brief Definition of the Script class.
+    @ingroup Objects
+*/
+
 #ifndef _Script_H__
 #define _Script_H__
 
@@ -41,13 +47,15 @@
 namespace orxonox
 {
 
+    /**
+    @brief The mode a specific @ref orxonox::Script "Script" is in.
+    */
     namespace ScriptMode
     {
-        //! Modes of the Script class.
         enum Value
         {
-            normal,
-            lua
+            normal, //!< The @ref orxonox::Script "Scripts'" code is executed through the @ref orxonox::CommandExecutor "CommandExecutor".
+            lua //!< The @ref orxonox::Script "Scripts'" code is executed through lua.
         };
     }
 
@@ -55,17 +63,17 @@
     @brief
         The Script class lets you execute a piece of code, either the normal way or in lua, through XML. It can be specified whether the code is executed upon loading (creation) of the object. Additionally the code is executed each time a trigger event comes in.
         There are three parameters:
-        'code': The code that should be executed.
-        'mode': The mode, specifying whether the set code should be executed the normal way ('normal') or in lua ('lua'). Default is 'normal'.
-        'onLoad': Whether the code is executed upon loading (creation) of this object. If this is set the code is executed ofr all players, regardless of the value of parameter 'forAll'. Default is true.
-        'needsGraphics': Whether the code needs graphics to be executed or not. Default is false.
-        'forAll': Whether the code is executed for all players each time the Script is triggered or jut for the player triggering the Script. If forAll is false, which is default, the event that triggers the Script must come from a PlayerTrigger.
+        - @b code The code that should be executed.
+        - @b mode The mode, specifying whether the set code should be executed the normal way (<em>normal</em>) or in lua (<em>lua</em>). Default is <em>normal</em>.
+        - @b onLoad Whether the code is executed upon loading (creation) of this object. If this is set the code is executed ofr all players, regardless of the value of parameter <em>forAll</em>. Default is true.
+        - @b needsGraphics Whether the code needs graphics to be executed or not. Default is false.
+        - @b forAll Whether the code is executed for all players each time the Script is triggered or jut for the player triggering the Script. If forAll is false, which is default, the event that triggers the Script must come from a @ref orxonox::PlayerTrigger "PlayerTrigger".
 
         Here are two examples illustrating the usage:
         @code
         <Script code="showGUI QuestGUI" needsGraphics=true />
         @endcode
-        This would show the QuestGUI opon creation of the object. The mode is 'normal', not specified here since that is the default, also onLoad is true, also not specified, since it is the default as well. Also needsGraphics is set to true because showGUI needs graphics to work.
+        This would show the QuestGUI opon creation of the object. The <em>mode</em> is <em>normal</em>, not specified here since that is the default, also <em>onLoad</em> is true, also not specified, since it is the default as well. Also <em>needsGraphics</em> is set to true because showGUI needs graphics to work.
 
         @code
         <Script code="hideGUI QuestGUI" mode="normal" onLoad="false" needsGraphics=true >
@@ -76,7 +84,8 @@
             </events>
         </Script>
         @endcode
-        This would hide the QuestGUI as soon as a Pawn got in range of the DistanceTrigger. The mode is 'normal', it is specified here, but could be ommitted as well, since it is the default. OnLoad is false, that is why it can't be ommitted. Also needsGraphics is set to true because showGUI needs graphics to work.
+        This would hide the QuestGUI as soon as a @ref orxonox::Pawn "Pawn" got in range of the @ref orxonox::DistanceTrigger "DistanceTrigger". The mode is <em>normal</em>, it is specified here, but could be ommitted as well, since it is the default. <em>OnLoad</em> is false, that is why it can't be ommitted. Also <em>needsGraphics</em> is set to true because showGUI needs graphics to work.
+
     @author
         Benjamin Knecht
     @author

Modified: code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file BoxCollisionShape.h
+    @brief Definition of the BoxCollisionShape class.
+    @ingroup Collisionshapes
+*/
+
 #ifndef _BoxCollisionShape_H__
 #define _BoxCollisionShape_H__
 

Modified: code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file ConeCollisionShape.h
+    @brief Definition of the ConeCollisionShape class.
+    @ingroup Collisionshapes
+*/
+
 #ifndef _ConeCollisionShape_H__
 #define _ConeCollisionShape_H__
 

Modified: code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file PlaneCollisionShape.h
+    @brief Definition of the PlaneCollisionShape class.
+    @ingroup Collisionshapes
+*/
+
 #ifndef _PlaneCollisionShape_H__
 #define _PlaneCollisionShape_H__
 

Modified: code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file SphereCollisionShape.h
+    @brief Definition of the SphereCollisionShape class.
+    @ingroup Collisionshapes
+*/
+
 #ifndef _SphereCollisionShape_H__
 #define _SphereCollisionShape_H__
 

Modified: code/trunk/src/modules/objects/eventsystem/EventDispatcher.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventDispatcher.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/eventsystem/EventDispatcher.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file EventDispatcher.h
+    @brief Definition of the EventDispatcher class.
+    @ingroup Eventsystem
+*/
+
 #ifndef _EventDispatcher_H__
 #define _EventDispatcher_H__
 

Modified: code/trunk/src/modules/objects/eventsystem/EventFilter.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventFilter.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/eventsystem/EventFilter.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file EventFilter.h
+    @brief Definition of the EventFilter class.
+    @ingroup Eventsystem
+*/
+
 #ifndef _EventFilter_H__
 #define _EventFilter_H__
 

Modified: code/trunk/src/modules/objects/eventsystem/EventListener.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventListener.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/eventsystem/EventListener.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file EventListener.h
+    @brief Definition of the EventListener class.
+    @ingroup Eventsystem
+*/
+
 #ifndef _EventListener_H__
 #define _EventListener_H__
 

Modified: code/trunk/src/modules/objects/eventsystem/EventName.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventName.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/eventsystem/EventName.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file EventName.h
+    @brief Definition of the EventName class.
+    @ingroup Eventsystem
+*/
+
 #ifndef _EventName_H__
 #define _EventName_H__
 

Modified: code/trunk/src/modules/objects/eventsystem/EventTarget.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventTarget.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/eventsystem/EventTarget.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file EventTarget.h
+    @brief Definition of the EventTarget class.
+    @ingroup Eventsystem
+*/
+
 #ifndef _EventTarget_H__
 #define _EventTarget_H__
 

Modified: code/trunk/src/modules/objects/triggers/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/objects/triggers/CMakeLists.txt	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/CMakeLists.txt	2010-10-30 11:54:49 UTC (rev 7601)
@@ -8,4 +8,5 @@
   MultiTrigger.cc
   MultiTriggerContainer.cc
   Trigger.cc
+  TriggerBase.cc
 )

Modified: code/trunk/src/modules/objects/triggers/CheckPoint.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/CheckPoint.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/CheckPoint.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file CheckPoint.cc
+    @brief Implementation of the CheckPoint class.
+    @ingroup NormalTrigger
+*/
+
 #include "CheckPoint.h"
 
 #include "core/CoreIncludes.h"

Modified: code/trunk/src/modules/objects/triggers/CheckPoint.h
===================================================================
--- code/trunk/src/modules/objects/triggers/CheckPoint.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/CheckPoint.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -27,8 +27,9 @@
  */
 
 /**
-    @file
-    @brief
+    @file CheckPoint.h
+    @brief Definition of the CheckPoint class.
+    @ingroup NormalTrigger
 */
 
 #ifndef _CheckPoint_H__
@@ -41,6 +42,15 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+
+    @author
+        Aurelian Jaggi
+
+    @ingroup NormalTrigger
+    */
     class _ObjectsExport CheckPoint : public DistanceTrigger, public RadarViewable
     {
     public:

Modified: code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,12 +29,14 @@
 /**
     @file DistanceMultiTrigger.cc
     @brief Implementation of the DistanceMultiTrigger class.
+    @ingroup MultiTrigger
 */
 
 #include "DistanceMultiTrigger.h"
 
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
+
 #include "DistanceTriggerBeacon.h"
 
 namespace orxonox
@@ -130,7 +132,7 @@
             // If the DistanceMultiTrigger is in single-target mode.
             if(this->singleTargetMode_)
             {
-                // If the object that is a target is no DistanceTriggerBeacon, then the DistanceMultiTrigger can't be in single-target-mode.
+                // If the object that is a target is no DistanceTriggerBeacon, then the DistanceMultiTrigger can't be in single-target mode.
                 if(!entity->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()))
                 {
                     this->singleTargetMode_ = false;

Modified: code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,6 +29,7 @@
 /**
     @file DistanceMultiTrigger.h
     @brief Definition of the DistanceMultiTrigger class.
+    @ingroup MultiTrigger
 */
 
 #ifndef _DistanceMultiTrigger_H__
@@ -36,10 +37,12 @@
 
 #include "objects/ObjectsPrereqs.h"
 
-#include "worldentities/WorldEntity.h"
-#include "core/WeakPtr.h"
 #include <map>
 
+#include "core/WeakPtr.h"
+
+#include "worldentities/WorldEntity.h"
+
 #include "MultiTrigger.h"
 
 namespace orxonox
@@ -47,25 +50,29 @@
 
     /**
     @brief
-        The DistanceMultiTrigger is a trigger that triggers whenever an object (that is of the specified target type) is in a specified range of the DistanceMultiTrigger. The object can be specified further by adding a DistanceTriggerBeacon (just attaching it) to the objects that can trigger this DistanceMultiTrigger and specify the name of the DistanceTriggerBeacon with the parameter targetname and only objects that have a DistanceTriggerBeacon with that name attached will trigger the DistanceMultiTrigger.
+        The DistanceMultiTrigger is a MultiTrigger that triggers whenever an object (that is of the specified target type) is in a specified range of the DistanceMultiTrigger. The object can be specified further by adding a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" (by just attaching it) to the objects that can trigger this DistanceMultiTrigger and specify the name of the @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" with the parameter <em>targetname</em> and only objects that have a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" with that name will trigger the DistanceMultiTrigger.
         Parameters are (additional to the ones of MultiTrigger):
-            'distance', which specifies the maximum distance at which the DistanceMultiTrigger still triggers. Default is 100.
-            'targetname', which, if not left blank, causes the DistancMultiTrigger to be in single-target mode, meaning, that it only reacts to objects that have a DistanceTriggerBeacon (therefore the target has to be set to DistanceTriggerBeacon for it to work), with the name specified by targetname, attached.
+        - @b distance Which specifies the maximum distance at which the DistanceMultiTrigger still triggers. Default is 100.
+        - @b targetname Which, if not left blank, causes the DistancMultiTrigger to be in <em>single-target</em> mode, meaning, that it only reacts to objects that have a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" (therefore the target has to be set to @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" for it to work), with the name specified by <em>targetname</em>, attached.
 
         A simple DistanceMultiTrigger would look like this:
         @code
         <DistanceMultiTrigger position="0,0,0" switch="true" target="Pawn" distance="20" />
         @endcode
 
-        An implementation that only reacts to objects with a DistanceTriggerBeacon attached would look like this:
+        An implementation that only reacts to objects with a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" attached would look like this:
         @code
         <DistanceMultiTrigger position="0,0,0" target="DistanceMultiTrigger" targetname="beacon1" distance="30" />
         @endcode
-        This particular DistanceMultiTrigger would only react if an object was in range, that had a DistanceTriggerBeacon with the name 'beacon1' attached.
-    @see MultiTrigger.h
+        This particular DistanceMultiTrigger would only react if an object was in range, that had a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" with the name <em>beacon1</em> attached.
+
+    @see MultiTrigger
         For more information on MultiTriggers.
+
     @author
         Damian 'Mozork' Frick
+
+    @ingroup MultiTrigger
     */
     class _ObjectsExport DistanceMultiTrigger : public MultiTrigger
     {
@@ -105,8 +112,8 @@
 
         private:
             float distance_; //!< The distance at which the DistanceMultiTrigger triggers.
-            std::string targetName_; //!< The target name, used in singleTargetMode.
-            bool singleTargetMode_; //!< To indicate whe the MultiDistanceTrigger is in single-target-mode.
+            std::string targetName_; //!< The target name, used in <em>single-target</em> mode.
+            bool singleTargetMode_; //!< To indicate whe the MultiDistanceTrigger is in <em>single-target</em> mode.
 
             std::map<WorldEntity*, WeakPtr<WorldEntity>* > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger.
 

Modified: code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTrigger.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/DistanceTrigger.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file DistanceTrigger.cc
+    @brief Implementation of the DistanceTrigger class.
+    @ingroup NormalTrigger
+*/
+
 #include "DistanceTrigger.h"
 
 #include "core/CoreIncludes.h"
@@ -45,7 +51,6 @@
     this->targetMask_.exclude(Class(BaseObject));
     this->targetName_ = BLANKSTRING;
     this->singleTargetMode_ = false;
-    this->setForPlayer(false); //!< Normally hasn't just players as targets.
   }
 
   DistanceTrigger::~DistanceTrigger()

Modified: code/trunk/src/modules/objects/triggers/DistanceTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTrigger.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/DistanceTrigger.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file DistanceTrigger.h
+    @brief Definition of the DistanceTrigger class.
+    @ingroup NormalTrigger
+*/
+
 #ifndef _DistanceTrigger_H__
 #define _DistanceTrigger_H__
 
@@ -38,6 +44,17 @@
 
 namespace orxonox
 {
+
+  /**
+  @brief
+
+  @author
+    Benjamin Knecht
+  @author
+    Damian 'Mozork' Frick
+
+  @ingroup NormalTrigger
+  */
   class _ObjectsExport DistanceTrigger : public Trigger, public PlayerTrigger
   {
     public:

Modified: code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,6 +29,7 @@
 /**
     @file DistanceTriggerBeacon.cc
     @brief Implementation of the DistanceTriggerBeacon class.
+    @ingroup Triggers
 */
 
 #include "DistanceTriggerBeacon.h"

Modified: code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,6 +29,7 @@
 /**
     @file DistanceTriggerBeacon.h
     @brief Definition of the DistanceTriggerBeacon class.
+    @ingroup Triggers
 */
 
 #ifndef _DistanceTriggerBeacon_H__
@@ -43,10 +44,13 @@
 
     /**
     @brief
-        A DistanceTriggerBeacon can be used together with a DistanceTrigger or a DistanceMultiTrigger to make them only react to specific objects.
-        This can be done by attaching a DistanceTriggerBeacon to an object, giving it a unique name and setting the targetname in the DistanceTrigger (or DistanceMultiTrigger) to that name and the target to DistanceTriggerBeacon.
+        A DistanceTriggerBeacon can be used together with a @ref orxonox::DistanceTrigger "DistanceTrigger" or a @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" to make them only react to specific objects.
+        This can be done by attaching a DistanceTriggerBeacon to an object, giving it a unique name and setting the targetname in the @ref orxonox::DistanceTrigger "DistanceTrigger" (or @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger") to that name and the target to DistanceTriggerBeacon.
+
     @author
         Damian 'Mozork' Frick
+
+    @ingroup Triggers
     */
     class _ObjectsExport DistanceTriggerBeacon : public StaticEntity
     {

Modified: code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,6 +29,7 @@
 /**
     @file EventMultiTrigger.cc
     @brief Implementation of the EventMultiTrigger class.
+    @ingroup MultiTrigger
 */
 
 #include "EventMultiTrigger.h"

Modified: code/trunk/src/modules/objects/triggers/EventMultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/EventMultiTrigger.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/EventMultiTrigger.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,6 +29,7 @@
 /**
     @file EventMultiTrigger.h
     @brief Definition of the EventMultiTrigger class.
+    @ingroup MultiTrigger
 */
 
 #ifndef _EventMultiTrigger_H__
@@ -43,9 +44,9 @@
 
     /**
     @brief
-        The EventMultiTrigger class is the equivalent of the EventTrigger class for MultiTriggers.
-        Consequentially what it does is it provides a way to have a MultiTrigger triggered by any kinds of events.
-        Events that are not caused by a MultiTrigger or by a MultiTrigger with an originator that is no target of this EventMultiTrigger are broadcasted to all entities that are the target of this EventMultitrigger. Events that are caused by MultiTriggers with an originator that is a target of this EventMultiTrigger just trigger the EventMultiTrigger for the originator that caused the MultiTrigger to trigger. Thus showing the equivalent behavior to the EventTrigger.
+        The EventMultiTrigger class is the equivalent of the @ref orxonox::EventTrigger "EventTrigger" class for MultiTriggers.
+        Consequentially what it does is it provides a way to have a MultiTrigger triggered by any kinds of @ref orxonox::Event "Events".
+        @ref orxonox::Event "Events" that are not caused by a MultiTrigger, or that are caused by a MultiTrigger with an originator that is no target of this EventMultiTrigger, are broadcasted to all entities that are the target of this EventMultiTrigger. @ref orxonox::Event "Events" that are caused by @ref orxonox::MultiTrigger "MultiTriggers" with an originator that is a target of this EventMultiTrigger just trigger the EventMultiTrigger for the originator that caused the MultiTrigger to trigger. Thus showing the equivalent behavior to the @ref orxonox::EventTrigger "EventTrigger".
 
         Example:
         @code
@@ -58,10 +59,14 @@
             </events>
         </EventMultiTrigger>
         @endcode
-    @see MultiTrigger.h
+
+    @see MultiTrigger
         For more information on MultiTriggers.
+
     @author
         Damian 'Mozork' Frick
+
+    @ingroup MultiTrigger
     */
     class _ObjectsExport EventMultiTrigger : public MultiTrigger
     {
@@ -74,7 +79,7 @@
             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
 
         private:
-            void trigger(bool bTriggered, BaseObject* originator); //!< Method that causes the EventMultiTrigger to trigger upon receiving an event.
+            void trigger(bool bTriggered, BaseObject* originator); //!< Method that causes the EventMultiTrigger to trigger upon receiving an @ref orxonox::Event "Event".
 
     };
 

Modified: code/trunk/src/modules/objects/triggers/EventTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/EventTrigger.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/EventTrigger.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file EventTrigger.cc
+    @brief Implementation of the EventTrigger class.
+    @ingroup NormalTrigger
+*/
+
 #include "EventTrigger.h"
 
 #include "core/CoreIncludes.h"

Modified: code/trunk/src/modules/objects/triggers/EventTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/EventTrigger.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/EventTrigger.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file EventTrigger.h
+    @brief Definition of the EventTrigger class.
+    @ingroup NormalTrigger
+*/
+
 #ifndef _EventTrigger_H__
 #define _EventTrigger_H__
 
@@ -34,6 +40,15 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+
+    @author
+        Fabian 'x3n' Landau
+
+    @ingroup NormalTrigger
+    */
     class _ObjectsExport EventTrigger : public Trigger
     {
         public:

Modified: code/trunk/src/modules/objects/triggers/MultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTrigger.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/MultiTrigger.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,6 +29,7 @@
 /**
     @file MultiTrigger.cc
     @brief Implementation of the MultiTrigger class.
+    @ingroup MultiTrigger
 */
 
 #include "MultiTrigger.h"
@@ -41,12 +42,6 @@
 namespace orxonox
 {
 
-    // Initialization of some static (magic) variables.
-    /*static*/ const int MultiTrigger::INF_s = -1;
-    /*static*/ const std::string MultiTrigger::and_s = "and";
-    /*static*/ const std::string MultiTrigger::or_s = "or";
-    /*static*/ const std::string MultiTrigger::xor_s = "xor";
-
     CreateFactory(MultiTrigger);
 
     /**
@@ -55,28 +50,18 @@
     @param creator
         The creator.
     */
-    MultiTrigger::MultiTrigger(BaseObject* creator) : StaticEntity(creator)
+    MultiTrigger::MultiTrigger(BaseObject* creator) : TriggerBase(creator)
     {
         RegisterObject(MultiTrigger);
 
-        this->bFirstTick_ = true;
-
-        this->delay_ = 0.0f;
-        this->bSwitch_ = false;
-        this->bStayActive_ = false;
-
-        this->remainingActivations_ = INF_s;
         this->maxNumSimultaneousTriggerers_ = INF_s;
 
-        this->bInvertMode_ = false;
-        this->mode_ = MultiTriggerMode::EventTriggerAND;
-
         this->bBroadcast_ = false;
 
-        this->parentTrigger_ = NULL;
-
         this->targetMask_.exclude(Class(BaseObject));
 
+        this->bMultiTrigger_ = true;
+
         this->setSyncMode(0x0);
     }
 
@@ -104,18 +89,10 @@
     {
         SUPER(MultiTrigger, XMLPort, xmlelement, mode);
 
-        XMLPortParam(MultiTrigger, "delay", setDelay, getDelay, xmlelement, mode);
-        XMLPortParam(MultiTrigger, "switch", setSwitch, getSwitch, xmlelement, mode);
-        XMLPortParam(MultiTrigger, "stayactive", setStayActive, getStayActive, xmlelement, mode);
-        XMLPortParam(MultiTrigger, "activations", setActivations, getActivations, xmlelement, mode);
         XMLPortParam(MultiTrigger, "simultaneousTriggerers", setSimultaneousTriggerers, getSimultaneousTriggerers, xmlelement, mode);
-        XMLPortParam(MultiTrigger, "invert", setInvert, getInvert, xmlelement, mode);
-        XMLPortParamTemplate(MultiTrigger, "mode", setMode, getModeString, xmlelement, mode, const std::string&);
         XMLPortParam(MultiTrigger, "broadcast", setBroadcast, getBroadcast, xmlelement, mode);
         XMLPortParamLoadOnly(MultiTrigger, "target", addTargets, xmlelement, mode).defaultValues("Pawn"); //TODO: Remove load only
 
-        XMLPortObject(MultiTrigger, MultiTrigger, "", addTrigger, getTrigger, xmlelement, mode);
-
         COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") created." << std::endl;
     }
 
@@ -123,9 +100,11 @@
     /**
     @brief
         A method that is executed each tick.
+        Most of the magic of MultiTriggers happens here.
     @param dt
         The duration of the last tick.
     */
+    //TODO: Segment into some helper methods?
     void MultiTrigger::tick(float dt)
     {
         // If this is the first tick.
@@ -158,10 +137,10 @@
                 }
 
                 // The new triggered state dependent on the requested state, the mode and the invert-mode.
-                bool bTriggered = (state->bTriggered & this->isModeTriggered(state->originator)) ^ this->bInvertMode_;
+                bool bTriggered = (state->bTriggered & this->isModeTriggered(state->originator)) ^ this->getInvert();
 
                 // If the 'triggered' state has changed or the MultiTrigger has delay and thus we don't know whether this state will actually change the 'triggered' state, a new state is added to the state queue.
-                if(this->delay_ > 0.0f || bTriggered ^ this->isTriggered(state->originator))
+                if(this->getDelay() > 0.0f || bTriggered ^ this->isTriggered(state->originator))
                 {
                     state->bTriggered = bTriggered;
                     this->addState(state);
@@ -191,7 +170,7 @@
                 if(timeRemaining <= dt)
                 {
                     // If the maximum number of objects simultaneously triggering this MultiTrigger is not exceeded.
-                    if(this->maxNumSimultaneousTriggerers_ == INF_s || this->triggered_.size() < (unsigned int)this->maxNumSimultaneousTriggerers_)
+                    if(this->getSimultaneousTriggerers() == TriggerBase::INF_s || this->triggered_.size() < (unsigned int)this->getSimultaneousTriggerers())
                     {
                         bool bStateChanged = false;
                         // If the 'triggered' state is different from what it is now, change it.
@@ -210,7 +189,7 @@
                         // Get the activity of the new state.
                         bool bActive;
                         // If the MultiTrigger is in switch mode the 'active'-state only changes of the state changed to triggered.
-                        if(this->bSwitch_ && !state->bTriggered)
+                        if(this->getSwitch() && !state->bTriggered)
                             bActive = this->isActive(state->originator);
                         else
                             bActive = !this->isActive(state->originator);
@@ -238,7 +217,7 @@
                             else
                             {
                                 // If the MultiTrigger doesn't stay active or hasn't' exceeded its remaining activations.
-                                if(!this->bStayActive_ || this->remainingActivations_ > 0)
+                                if(!this->getStayActive() || this->remainingActivations_ > 0)
                                     this->active_.erase(state->originator);
                                 else
                                     bFire = false;
@@ -248,7 +227,7 @@
                             if(bFire)
                             {
                                 // If the MultiTrigger is set to broadcast and has no originator a boradcast is fired.
-                                if(this->bBroadcast_ && state->originator == NULL)
+                                if(this->getBroadcast() && state->originator == NULL)
                                     this->broadcast(bActive);
                                 // Else a normal event is fired.
                                 else
@@ -266,9 +245,9 @@
                             else
                                 COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: NULL, active: " << bActive << ", triggered: " << state->bTriggered << "." << std::endl;
 
-                            // If the MultiTrigger has a parent trigger it needs to call a method to notify him, that its activity has changed.
-                            if(this->parentTrigger_ != NULL)
-                                this->parentTrigger_->subTriggerActivityChanged(state->originator);
+                            // If the MultiTrigger has a parent trigger, that is itself a MultiTrigger, it needs to call a method to notify him, that its activity has changed.
+                            if(this->parent_ != NULL && this->parent_->isMultiTrigger())
+                                static_cast<MultiTrigger*>(this->parent_)->childActivityChanged(state->originator);
                         }
 
                         // If the MultiTrigger has exceeded its amount of activations and it doesn't stay active, it has to be deactivated.
@@ -301,9 +280,9 @@
     @return
         Returns true if the MultiTrigger is active, false if not.
     */
-    bool MultiTrigger::isActive(BaseObject* triggerer)
+    bool MultiTrigger::isActive(BaseObject* triggerer) const
     {
-        std::set<BaseObject*>::iterator it = this->active_.find(triggerer);
+        std::set<BaseObject*>::const_iterator it = this->active_.find(triggerer);
         if(it == this->active_.end())
             return false;
         return true;
@@ -311,42 +290,6 @@
 
     /**
     @brief
-        Set the mode of the MultiTrigger.
-    @param modeName
-        The name of the mode as a string.
-    */
-    void MultiTrigger::setMode(const std::string& modeName)
-    {
-        if (modeName == MultiTrigger::and_s)
-            this->setMode(MultiTriggerMode::EventTriggerAND);
-        else if (modeName == MultiTrigger::or_s)
-            this->setMode(MultiTriggerMode::EventTriggerOR);
-        else if (modeName == MultiTrigger::xor_s)
-            this->setMode(MultiTriggerMode::EventTriggerXOR);
-        else
-            COUT(2) << "Invalid mode '" << modeName << "' in MultiTrigger " << this->getName() << " &(" << this << "). Leaving mode at '" << this->getModeString() << "'." << std::endl;
-    }
-
-    /**
-    @brief
-        Get the mode of the MultiTrigger.
-    @return
-        Returns the mode as a string.
-    */
-    const std::string& MultiTrigger::getModeString() const
-    {
-        if (this->mode_ == MultiTriggerMode::EventTriggerAND)
-            return MultiTrigger::and_s;
-        else if (this->mode_ == MultiTriggerMode::EventTriggerOR)
-            return MultiTrigger::or_s;
-        else if (this->mode_ == MultiTriggerMode::EventTriggerXOR)
-            return MultiTrigger::xor_s;
-        else // This can never happen, but the compiler needs it to feel secure.
-            return MultiTrigger::and_s;
-    }
-
-    /**
-    @brief
         Add some target to the MultiTrigger.
     @param targetStr
         The target as a string.
@@ -396,43 +339,6 @@
 
     /**
     @brief
-        Adds a MultiTrigger as a sub-trigger to the trigger.
-        Beware: Loops are not prevented and potentially very bad, so just don't create any loops.
-    @param trigger
-        The MultiTrigger to be added.
-    */
-    void MultiTrigger::addTrigger(MultiTrigger* trigger)
-    {
-        if (this != trigger && trigger != NULL)
-            this->subTriggers_.insert(trigger);
-        trigger->addParentTrigger(this);
-    }
-
-    /**
-    @brief
-        Get the sub-trigger of this MultiTrigger at the given index.
-    @param index
-        The index.
-    @return
-        Returns a pointer ot the MultiTrigger. NULL if no such trigger exists.
-    */
-    const MultiTrigger* MultiTrigger::getTrigger(unsigned int index) const
-    {
-        // If the index is greater than the number of sub-triggers.
-        if (this->subTriggers_.size() <= index)
-            return NULL;
-
-        std::set<MultiTrigger*>::const_iterator it;
-        it = this->subTriggers_.begin();
-
-        for (unsigned int i = 0; i != index; ++i)
-            ++it;
-
-        return (*it);
-    }
-
-    /**
-    @brief
         This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.
         This method is the device for the behavior (the conditions under which the MultiTrigger triggers) of any derived class of MultiTrigger.
     @return
@@ -455,57 +361,57 @@
     void MultiTrigger::changeTriggered(BaseObject* originator)
     {
         MultiTriggerState* state = new MultiTriggerState;
-        state->bTriggered = (!this->isTriggered(originator) & this->isModeTriggered(originator)) ^ this->bInvertMode_;
+        state->bTriggered = (!this->isTriggered(originator) & this->isModeTriggered(originator)) ^ this->getInvert();
         state->originator = originator;
         this->addState(state);
     }
 
     /**
     @brief
-        This method is called by any sub-trigger to advertise changes in its state to its parent-trigger.
+        This method is called by any child to advertise changes in its state to its parent.
     @param originator
         The object that caused the change in activity.
     */
-    void MultiTrigger::subTriggerActivityChanged(BaseObject* originator)
+    void MultiTrigger::childActivityChanged(BaseObject* originator)
     {
         MultiTriggerState* state = new MultiTriggerState;
-        state->bTriggered = (this->isTriggered(originator) & this->isModeTriggered(originator)) ^ this->bInvertMode_;
+        state->bTriggered = (this->isTriggered(originator) & this->isModeTriggered(originator)) ^ this->getInvert();
         state->originator = originator;
         this->addState(state);
     }
 
     /**
     @brief
-        Checks whether the sub-triggers are in such a way that, according to the mode of the MultiTrigger, the MultiTrigger is triggered (only considering the sub-triggers, not the state of MultiTrigger itself), for a given object.
-        To make an example: When the mode is 'and', then this would be true or a given object if all the sub-triggers were triggered for the given object.
+        Checks whether the children are in such a way that, according to the mode of the MultiTrigger, the MultiTrigger is triggered (only considering the children, not the state of MultiTrigger itself), for a given object.
+        To make an example: When the mode is <em>and</em>, then this would be true or a given object if all the children were triggered for the given object.
     @param triggerer
         The object.
     @return
-        Returns true if the MultiTrigger is triggered concerning it's sub-triggers.
+        Returns true if the MultiTrigger is triggered concerning it's children.
     */
     bool MultiTrigger::isModeTriggered(BaseObject* triggerer)
     {
-        if(this->subTriggers_.size() != 0)
+        if(this->children_.size() != 0)
         {
-            bool returnVal = false;
+            bool triggered = false;
 
             switch(this->mode_)
             {
-                case MultiTriggerMode::EventTriggerAND:
-                    returnVal = checkAnd(triggerer);
+                case TriggerMode::EventTriggerAND:
+                    triggered = checkAnd(triggerer);
                     break;
-                case MultiTriggerMode::EventTriggerOR:
-                    returnVal = checkOr(triggerer);
+                case TriggerMode::EventTriggerOR:
+                    triggered = checkOr(triggerer);
                     break;
-                case MultiTriggerMode::EventTriggerXOR:
-                    returnVal = checkXor(triggerer);
+                case TriggerMode::EventTriggerXOR:
+                    triggered = checkXor(triggerer);
                     break;
                 default: // This will never happen.
-                    returnVal = false;
+                    triggered = false;
                     break;
             }
 
-            return returnVal;
+            return triggered;
         }
 
         return true;
@@ -584,14 +490,14 @@
         }
 
         // Add it ot the state queue with the delay specified for the MultiTrigger.
-        this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(this->delay_, state));
+        this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(this->getDelay(), state));
 
         return true;
     }
 
     /**
     @brief
-        Checks whether the sub-triggers amount to true for the 'and' mode for a given object.
+        Checks whether the children amount to true for the <em>and</em> mode for a given object.
     @param triggerer
         The object.
     @return
@@ -599,17 +505,26 @@
     */
     bool MultiTrigger::checkAnd(BaseObject* triggerer)
     {
-        for(std::set<MultiTrigger*>::iterator it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it)
+        for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
         {
-            if(!(*it)->isActive(triggerer))
-                return false;
+            TriggerBase* trigger = *it;
+            if(trigger->isMultiTrigger())
+            {
+                if(!static_cast<MultiTrigger*>(trigger)->isActive(triggerer))
+                    return false;
+            }
+            else
+            {
+                if(!trigger->isActive())
+                    return false;
+            }
         }
         return true;
     }
 
     /**
     @brief
-        Checks whether the sub-triggers amount to true for the 'or' mode for a given object.
+        Checks whether the children amount to true for the <em>or</em> mode for a given object.
     @param triggerer
         The object.
     @return
@@ -617,17 +532,26 @@
     */
     bool MultiTrigger::checkOr(BaseObject* triggerer)
     {
-        for(std::set<MultiTrigger*>::iterator it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it)
+        for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
         {
-            if((*it)->isActive(triggerer))
-                return true;
+            TriggerBase* trigger = *it;
+            if(trigger->isMultiTrigger())
+            {
+                if(static_cast<MultiTrigger*>(trigger)->isActive(triggerer))
+                    return true;
+            }
+            else
+            {
+                if(trigger->isActive())
+                    return true;
+            }
         }
         return false;
     }
 
     /**
     @brief
-        Checks whether the sub-triggers amount to true for the 'xor' mode for a given object.
+        Checks whether the children amount to true for the <em>xor</em> mode for a given object.
     @param triggerer
         The object.
     @return
@@ -635,16 +559,36 @@
     */
     bool MultiTrigger::checkXor(BaseObject* triggerer)
     {
-        bool test = false;
-        for(std::set<MultiTrigger*>::iterator it = this->subTriggers_.begin(); it != this->subTriggers_.end(); ++it)
+        bool triggered = false;
+        for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
         {
-            if(test && (*it)->isActive(triggerer))
-                return false;
+            TriggerBase* trigger = *it;
+            if(triggered)
+            {
+                if(trigger->isMultiTrigger())
+                {
+                    if(static_cast<MultiTrigger*>(trigger)->isActive(triggerer))
+                        return false;
+                }
+                else
+                {
+                    if(trigger->isActive())
+                        return false;
+                }
+            }
 
-            if((*it)->isActive(triggerer))
-                test = true;
+            if(trigger->isMultiTrigger())
+            {
+                if(static_cast<MultiTrigger*>(trigger)->isActive(triggerer))
+                    triggered = true;
+            }
+            else
+            {
+                if(trigger->isActive())
+                    triggered = true;
+            }
         }
-        return test;
+        return triggered;
     }
 
 }

Modified: code/trunk/src/modules/objects/triggers/MultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTrigger.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/MultiTrigger.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,6 +29,7 @@
 /**
     @file MultiTrigger.h
     @brief Definition of the MultiTrigger class.
+    @ingroup MultiTrigger
 */
 
 #ifndef _MultiTrigger_H__
@@ -42,24 +43,17 @@
 #include <set>
 #include <deque>
 
-#include "tools/interfaces/Tickable.h"
-#include "worldentities/StaticEntity.h"
+#include "TriggerBase.h"
 
 namespace orxonox
 {
 
-    //! The different modes the MultiTrigger can be in.
-    namespace MultiTriggerMode
-    {
-        enum Value
-        {
-            EventTriggerAND,
-            EventTriggerOR,
-            EventTriggerXOR,
-        };
-    }
+    /**
+    @brief
+    Struct to handle @ref orxonox::MultiTrigger "MultiTrigger" states internally.
 
-    //! Struct to handle MultiTrigger states internally.
+    @ingroup MultiTrigger
+    */
     struct MultiTriggerState
     {
         BaseObject* originator;
@@ -69,36 +63,39 @@
     /**
     @brief
         The MultiTrigger class implements a trigger that has a distinct state for each object triggering it.
-        In more detail: A Trigger is an object that can either be active or inactive, with a specified behavior how to switch between the two. A MultiTrigger generalizes that behavior for multiple objects triggering the trigger. A MultiTrigger can be active or inactive for any object triggering it, with the state for each object being completely independent of the state for other objects. Each time a switch occurs an Event is fired with as the originator a MultiTriggerContainer, containing a pointer to the MultiTrigger that caused the Event and a pointer to the object that caused the trigger to change it's activity.
+        In more detail: A Trigger is an object that can either be <em>active</em> or <em>inactive</em>, with a specified behavior how to switch between the two. A MultiTrigger generalizes that behavior for multiple objects triggering the trigger. A MultiTrigger can be <em>active</em> or <em>inactive</em> for any object triggering it, with the state for each object being completely independent of the state for other objects. Each time a switch occurs an @ref orxonox::Event "Event" is fired with as the originator a @ref orxonox::MultiTriggerContainer "MultiTriggerContainer", containing a pointer to the MultiTrigger that caused the @ref orxonox::Event "Event" and a pointer to the object that caused the trigger to change it's activity.
 
         MultiTriggers also allow for additional complexity which can be added through the choice of the parameters explained (briefly) below:
-        But first you must understand a small implementational detail. There is a distinction between the MultiTrigger being triggered (there is the state 'triggered' for that) and the MultiTrigger being active (for that is the state 'activity'). From the outside only the activity is visible. The state 'triggered' tells us whether the trigger is actually triggered, but it could pretend (for some reason, some of which we will see shortly) to be triggered (or to the outside, active), while it in fact isn't. The standard behavior is, that the activity changes, when the MultiTrigger transits from being triggered to not being triggered or the other way around.
+        But first you must understand a small implementational detail. There is a distinction between the MultiTrigger being triggered (there is the state <em>triggered</em> for that) and the MultiTrigger being active (for that is the state <em>activity</em>). From the outside only the <em>activity</em> is visible. The state <em>triggered</em> tells us whether the trigger is actually triggered, but it could pretend (for some reason, some of which we will see shortly) to be triggered (or to the outside, active), while it in fact isn't. The standard behavior is, that the <em>activity</em> changes, when the MultiTrigger transits from being triggered to not being triggered or the other way around.
         The parameters are:
-            'delay':                    The delay is the time that the trigger waits until it reacts (i.e. changes it's state) to the triggering condition being fulfilled.
-            'switch':                   Switch is a bool, if true the MultiTrigger is in switch-mode, meaning, that the activity changes only when the trigger is triggered , this means, that now the activity only changes, when the trigger changes from not being triggered to being triggered but not the other way around. The default is false.
-            'stayactive':               Stay active is also a bool, if true the MultiTrigger stays active after it has been activated as many times as specified by the parameter activations. The default is false.
-            'activations':              The number of activations until the trigger can't be triggered anymore. The default is -1, which is infinity.
-            'invert':                   Invert is a bool, if true the trigger is in invert-mode, meaning, that if the triggering condition is fulfilled the MultiTrigger will have the state not triggered and and if the condition is not fulfilled it will have the state triggered. In short it just inverts the behavior of the MultiTrigger. The default is false.
-            'simultaneousTriggerers':   The number of simultaneous triggerers limits the number of objects that are allowed to trigger the MultiTrigger at the same time. Or more precisely, the number of distinct objects the MultiTrigger has 'triggered' states for, at each point in time. The default is -1, which denotes infinity.
-            'mode':                     The mode describes how the MultiTrigger acts in relation to all the MultiTriggers, that are appended to it. There are 3 modes: 'and', meaning that the MultiTrigger can only be triggered if all the appended MultiTriggers are active. 'or', meaning that the MultiTrigger can only triggered if at least one of the appended MultiTriggers is active. And 'xor', meaning that the MultiTrigger can only be triggered if one and only one appended MultiTrigger is active. Note, that I wrote 'can only be active', that implies, that there is an additional condition to the activity of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the activity of a MultiTrigger is still coupled to the object that triggered it. The default is 'and'.
-            'broadcast'                 Broadcast is a bool, if true the MutliTrigger is in broadcast-mode, meaning, that all trigger events that are caused by no originator (originator is NULL) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false.
-            'target':                   The target describes the kind of objects that are allowed to trigger this MultiTrigger. The default is 'Pawn'.
-            Also there is the possibility of appending MultiTriggers to the MultiTrigger just by adding them as sub-objects in the XML description of your MultiTrigger.
+        - @b delay The delay is the time that the trigger waits until it reacts (i.e. changes it's state) to the triggering condition being fulfilled.
+        - @b switch Switch is a boolean, if true the MultiTrigger is in switch-mode, meaning, that the <em>activity</em> changes only when the trigger is triggered, this means, that now the <em>activity</em> only changes, when the trigger changes from not being triggered to being triggered but not the other way around. The default is false.
+        - @b stayactive Stay active is also a boolean, if true the MultiTrigger stays active after it has been activated as many times as specified by the parameter activations. The default is false.
+        - @b activations The number of activations until the trigger can't be triggered anymore. The default is -1, which is infinity.
+        - @b invert Invert is a boolean, if true the trigger is in <em>invert-mode</em>, meaning, that if the triggering condition is fulfilled the MultiTrigger will have the state not triggered and and if the condition is not fulfilled it will have the state triggered. In short it just inverts the behavior of the MultiTrigger. The default is false.
+        - @b simultaneousTriggerers The number of simultaneous triggerers limits the number of objects that are allowed to trigger the MultiTrigger at the same time. Or more precisely, the number of distinct objects the MultiTrigger has <em>triggered</em> states for, at each point in time. The default is -1, which denotes infinity.
+        - @b mode The mode describes how the MultiTrigger acts in relation to all the triggers, that are appended to it. There are 3 modes: <em>and</em>, meaning that the MultiTrigger can only be triggered if all the appended triggers are active. <em>or</em>, meaning that the MultiTrigger can only triggered if at least one of the appended triggers is active. And <em>xor</em>, meaning that the MultiTrigger can only be triggered if one and only one appended trigger is active. Note, that I wrote <em>can only be active</em>, that implies, that there is an additional condition to the activity of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the activity of a MultiTrigger is still coupled to the object that triggered it. The default is <em>and</em>.
+        - @b broadcast Broadcast is a boolean, if true the MutliTrigger is in <em>broadcast-mode</em>, meaning, that all trigger events that are caused by no originator (originator is NULL) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false.
+        - @b target The target describes the kind of objects that are allowed to trigger this MultiTrigger. The default is @ref orxonox::Pawn "Pawn".
+        - Also there is the possibility of appending triggers (as long as they inherit from TriggerBase) to the MultiTrigger just by adding them as children in the XML description of your MultiTrigger.
 
         An example of a MultiTrigger created through XML would look like this:
         @code
         <MultiTrigger position="0,0,0" delay="1.3" switch="true" stayactive="true" activations="7" invert="true" simultaneousTriggerers="2" mode="xor" broadcast="false" target="Pawn">
-            <MultiTrigger />
+            <TriggerBase />
             ...
-            <MultiTrigger />
+            <TriggerBase />
         </MultiTrigger>
         @endcode
 
     @author
         Damian 'Mozork' Frick
-        Many concepts and loads of inspiration from the Trigger class by Benjamin Knecht.
+
+        Many concepts and loads of inspiration from the @ref orxonox::Trigger "Trigger" class by Benjamin Knecht.
+
+    @ingroup MultiTrigger
     */
-    class _ObjectsExport MultiTrigger : public StaticEntity, public Tickable
+    class _ObjectsExport MultiTrigger : public TriggerBase
     {
         public:
             MultiTrigger(BaseObject* creator); //!< Constructor. Registers the objects and initializes default values.
@@ -107,60 +104,20 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a MultiTrigger object through XML.
             virtual void tick(float dt); //!< A method that is executed each tick.
 
-            bool isActive(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is active for a given object.
-
             /**
-            @brief Set the delay of the MultiTrigger.
-            @param delay The delay to be set.
+            @brief Check whether the MultiTrigger is active.
+            @return Returns if the MultiTrigger is active.
             */
-            inline void setDelay(float delay)
-                { if(delay > 0.0f) this->delay_= delay; }
-            /**
-            @brief Get the delay of the MultiTrigger.
-            @return The delay.
-            */
-            inline float getDelay(void) const
-                { return this->delay_; }
+            inline bool isActive(void) const
+                { return this->isActive(NULL); }
+            bool isActive(BaseObject* triggerer = NULL) const; //!< Get whether the MultiTrigger is active for a given object.
 
             /**
-            @brief Set switch-mode of the MultiTrigger.
-            @param bSwitch If true the MultiTrigger is set to switched.
-            */
-            inline void setSwitch(bool bSwitch)
-                { this->bSwitch_ = bSwitch; }
-            /**
-            @brief Get the switch-mode of the MultiTrigger.
-            @return Returns true if the MultiTriger is in switch-mode.
-            */
-            inline bool getSwitch(void) const
-                { return this->bSwitch_; }
-
-            /**
-            @brief Set the stay-active-mode of the MultiTrigger.
-            @param bStayActive If true the MultiTrigger is set to stay active.
-            */
-            inline void setStayActive(bool bStayActive)
-                { this->bStayActive_ = bStayActive; }
-            /**
-            @brief Get the stay-active-mode of the MultiTrigger.
-            @return Returns true if the MultiTrigger stays active.
-            */
-            inline bool getStayActive(void) const
-                { return this->bStayActive_; }
-
-            /**
-            @brief Get the number of remaining activations of the MultiTrigger.
-            @return The number of activations. -1 denotes infinity.
-            */
-            inline int getActivations(void) const
-                { return this->remainingActivations_; }
-
-            /**
             @brief Set the number of objects that are allowed to simultaneously trigger this MultiTrigger.
             @param triggerers The number of objects. -1 denotes infinitely many.
             */
             inline void setSimultaneousTriggerers(int triggerers)
-                { if(triggerers >= 0 || triggerers == INF_s) this->maxNumSimultaneousTriggerers_ = triggerers; }
+                { if(triggerers >= 0 || triggerers == TriggerBase::INF_s) this->maxNumSimultaneousTriggerers_ = triggerers; }
             /**
             @brief Get the number of objects that are allowed to simultaneously trigger this MultiTriggger.
             @return Returns the number of objects. -1 denotes infinity.
@@ -169,34 +126,6 @@
                 { return this->maxNumSimultaneousTriggerers_; }
 
             /**
-            @brief Set the invert-mode of the MultiTrigger.
-            @param bInvert If true the MultiTrigger is set to invert.
-            */
-            inline void setInvert(bool bInvert)
-                { this->bInvertMode_ = bInvert; }
-            /**
-            @brief Get the invert-mode of the MultiTrigger.
-            @return Returns true if the MultiTrigger is set to invert.
-            */
-            inline bool getInvert(void) const
-                { return this->bInvertMode_; }
-
-            void setMode(const std::string& modeName); //!< Set the mode of the MultiTrigger.
-            /**
-            @brief Set the mode of the MultiTrigger.
-            @param mode The mode of the MultiTrigger.
-            */
-            inline void setMode(MultiTriggerMode::Value mode) //!< Get the mode of the MultiTrigger.
-                { this->mode_ = mode; }
-            const std::string& getModeString(void) const;
-            /**
-            @brief Get the mode of the MultiTrigger.
-            @return Returns and Enum for the mode of the MultiTrigger.
-            */
-            inline MultiTriggerMode::Value getMode() const
-                { return mode_; }
-
-            /**
             @brief Set the broadcast-mode of the MultiTrigger.
             @param bBroadcast If true the MultiTrigger is set to broadcast;
             */
@@ -217,38 +146,21 @@
             inline bool isTarget(BaseObject* target)
                 { if(target == NULL) return true; else return targetMask_.isIncluded(target->getIdentifier()); }
 
-            void addTrigger(MultiTrigger* trigger); //!< Adds a MultiTrigger as a sub-trigger to the trigger.
-            const MultiTrigger* getTrigger(unsigned int index) const; //!< Get the sub-trigger of this MultiTrigger at the given index.
-
         protected:
             virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.
 
             void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.
 
-            bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whetherx the MultiTrigger is triggered concerning it's sub-triggers.
+            bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whether the MultiTrigger is triggered concerning it's children.
             bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object.
 
             void fire(bool status, BaseObject* originator = NULL);  //!< Helper method. Creates an Event for the given status and originator and fires it.
             void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target.
 
-            /**
-            @brief Set the number of activations the MultiTrigger can go through.
-            @param activations The number of activations. -1 denotes infinitely many activations.
-            */
-            inline void setActivations(int activations)
-                { if(activations >= 0 || activations == INF_s) this->remainingActivations_ = activations; }
-
             void addTargets(const std::string& targets); //!< Add some target to the MultiTrigger.
             void removeTargets(const std::string& targets); //!< Remove some target from the MultiTrigger.
 
             /**
-            @brief Adds the parent of a MultiTrigger.
-            @param parent A pointer to the parent MultiTrigger.
-            */
-            inline void addParentTrigger(MultiTrigger* parent)
-                { this->parentTrigger_ = parent; }
-
-            /**
             @brief Get the target mask used to identify the targets of this MultiTrigger.
             @return Returns the target mask.
             */
@@ -256,19 +168,13 @@
                 { return this->targetMask_; }
 
         private:
-            static const int INF_s; //!< Magic number for infinity.
-            //! Magic strings for the mode.
-            static const std::string and_s;
-            static const std::string or_s;
-            static const std::string xor_s;
+            void childActivityChanged(BaseObject* originator); //!< This method is called by any child to advertise changes in it's state to it's parent.
 
-            void subTriggerActivityChanged(BaseObject* originator); //!< This method is called by any sub-trigger to advertise changes in it's state to it's parent-trigger.
-
             bool addState(MultiTriggerState* state); //!< Helper method. Adds a state to the state queue, where the state will wait to become active.
 
-            bool checkAnd(BaseObject* triggerer); //!< Checks whether the sub-triggers amount to true for the 'and' mode for a given object.
-            bool checkOr(BaseObject* triggerer); //!< Checks whether the sub-triggers amount to true for the 'or' mode for a given object.
-            bool checkXor(BaseObject* triggerer); //!< Checks whether the sub-triggers amount to true for the 'xor' mode for a given object.
+            bool checkAnd(BaseObject* triggerer); //!< Checks whether the children amount to true for the <em>and</em> mode for a given object.
+            bool checkOr(BaseObject* triggerer); //!< Checks whether the children amount to true for the <em>or</em> mode for a given object.
+            bool checkXor(BaseObject* triggerer); //!< Checks whether the children amount to true for the <em>xor</em> mode for a given object.
 
             /**
             @brief Get the objects for which this MultiTrigger is active.
@@ -277,23 +183,10 @@
             std::set<BaseObject*>& getActive(void)
                 { return this->active_; }
 
-            bool bFirstTick_; //!< Bool to distinguish the first tick form all the following.
-
-            float delay_; //!< The delay that is imposed on all new trigger events.
-            bool bSwitch_; //!< Bool for the switch-mode, if true the MultiTrigger behaves like a switch.
-            bool bStayActive_; //!< Bool for the stay-active-mode, if true the MultiTrigger stays active after its last activation.;
-
-            int remainingActivations_; //!< The remaining activations of this MultiTrigger.
             int maxNumSimultaneousTriggerers_; //!< The maximum number of objects simultaneously trigggering this MultiTrigger.
 
-            bool bInvertMode_; //!< Bool for the invert-mode, if true the MultiTrigger is inverted.
-            MultiTriggerMode::Value mode_; //!< The mode of the MultiTrigger.
-
             bool bBroadcast_; //!< Bool for the broadcast-mode, if true all triggers go to all possible targets.
 
-            MultiTrigger* parentTrigger_; //!< The parent-trigger of theis MultiTrigger.
-            std::set<MultiTrigger*> subTriggers_; //!< The sub-triggers of this MultiTrigger.
-
             std::set<BaseObject*> active_; //!< The set of all objects the MultiTrigger is active for.
             std::set<BaseObject*> triggered_; //!< The set of all objects the MultiTrigger is triggered for.
 

Modified: code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,11 +29,13 @@
 /**
     @file MultiTriggerContainer.cc
     @brief Implementation of the MultiTriggerContainer class.
+    @ingroup MultiTrigger
 */
 
 #include "MultiTriggerContainer.h"
 
 #include "core/CoreIncludes.h"
+
 #include "worldentities/pawns/Pawn.h"
 
 namespace orxonox

Modified: code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -29,6 +29,7 @@
 /**
     @file MultiTriggerContainer.h
     @brief Definition of the MultiTriggerContainer class.
+    @ingroup MultiTrigger
 */
 
 #ifndef _MultiTriggerContainer_H__
@@ -37,6 +38,7 @@
 #include "objects/ObjectsPrereqs.h"
 
 #include "core/BaseObject.h"
+
 #include "interfaces/PlayerTrigger.h"
 
 namespace orxonox
@@ -44,9 +46,12 @@
 
     /**
     @brief
-        This class is used by the MultiTrigger class to transport additional data via Events.
+        This class is used by the MultiTrigger class to transport additional data via @ref orxonox::Event "Events".
+
     @author
         Damian 'Mozork' Frick
+
+    @ingroup MultiTrigger
     */
     class _ObjectsExport MultiTriggerContainer : public BaseObject, public PlayerTrigger
     {

Modified: code/trunk/src/modules/objects/triggers/Trigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/Trigger.cc	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/Trigger.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file Trigger.cc
+    @brief Implementation of the Trigger class.
+    @ingroup NormalTrigger
+*/
+
 #include "Trigger.h"
 
 #include "core/CoreIncludes.h"
@@ -41,24 +47,16 @@
 
   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;
 
@@ -81,20 +79,11 @@
   void Trigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
   {
     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;
       this->triggered(false);
@@ -106,7 +95,7 @@
 
     SUPER(Trigger, tick, dt);
 
-    bool newTriggered = this->isTriggered() ^ this->bInvertMode_;
+    bool newTriggered = this->isTriggered() ^ this->getInvert();
 
     // check if new triggering event is really new
     if ((this->latestState_ & 0x1) != newTriggered)
@@ -120,7 +109,7 @@
       else
       {
         this->latestState_ &= 0xFE; // set trigger bit to 0
-        if (!this->bSwitch_)
+        if (!this->getSwitch())
           this->switchState();
       }
     }
@@ -144,7 +133,7 @@
       if (this->stateChanges_.size() != 0)
         this->remainingTime_ = this->stateChanges_.front().first;
       else
-        this->timeSinceLastEvent_ = this->delay_;
+        this->timeSinceLastEvent_ = this->getDelay();
     }
 
     if (this->bTriggered_ && this->bActive_)
@@ -196,7 +185,7 @@
 
   bool Trigger::checkAnd()
   {
-    std::set<Trigger*>::iterator it;
+    std::set<TriggerBase*>::iterator it;
     for(it = this->children_.begin(); it != this->children_.end(); ++it)
     {
       if (!(*it)->isActive())
@@ -207,7 +196,7 @@
 
   bool Trigger::checkOr()
   {
-    std::set<Trigger*>::iterator it;
+    std::set<TriggerBase*>::iterator it;
     for(it = this->children_.begin(); it != this->children_.end(); ++it)
     {
       if ((*it)->isActive())
@@ -218,7 +207,7 @@
 
   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)
     {
@@ -232,8 +221,8 @@
 
   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
     {
@@ -260,54 +249,11 @@
       this->remainingTime_ = this->stateChanges_.front().first;
   }
 
-  void Trigger::setDelay(float delay)
+  void Trigger::delayChanged(void)
   {
-    this->delay_ = delay;
-    this->timeSinceLastEvent_ = delay;
+    this->timeSinceLastEvent_ = this->getDelay();
   }
 
-  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::debugFlares(bool bVisible)
   {
     for (ObjectList<Trigger>::iterator it = ObjectList<Trigger>::begin(); it != ObjectList<Trigger>::end(); ++it)

Modified: code/trunk/src/modules/objects/triggers/Trigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/Trigger.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/modules/objects/triggers/Trigger.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file Trigger.h
+    @brief Definition of the Trigger class.
+    @ingroup NormalTrigger
+*/
+
 #ifndef _Trigger_H__
 #define _Trigger_H__
 
@@ -35,22 +41,21 @@
 #include <queue>
 
 #include "tools/BillboardSet.h"
-#include "tools/interfaces/Tickable.h"
-#include "worldentities/StaticEntity.h"
 
+#include "TriggerBase.h"
+
 namespace orxonox
 {
-  namespace TriggerMode
-  {
-    enum Value
-    {
-      EventTriggerAND,
-      EventTriggerOR,
-      EventTriggerXOR,
-    };
-  }
 
-  class _ObjectsExport Trigger : public StaticEntity, public Tickable
+  /**
+  @brief
+    
+  @author
+    Benjamin Knecht
+
+  @ingroup NormalTrigger
+  */
+  class _ObjectsExport Trigger : public TriggerBase
   {
     public:
       Trigger(BaseObject* creator);
@@ -59,44 +64,13 @@
       virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
       virtual void tick(float dt);
 
-      inline bool isActive() const
-        { return bActive_; }
+      inline bool isActive(void) const
+        { return this->bActive_; }
 
-      void addTrigger(Trigger* trigger);
-      const Trigger* getTrigger(unsigned int index) const;
-
-      void setMode(const std::string& modeName);
-      inline void setMode(TriggerMode::Value mode)
-        { this->mode_ = mode; }
-      inline TriggerMode::Value getMode() const
-        { return mode_; }
-
-      inline void setInvert(bool bInvert)
-        { this->bInvertMode_ = bInvert; }
-      inline bool getInvert() const
-        { return this->bInvertMode_; }
-
-      inline void setSwitch(bool bSwitch)
-        { this->bSwitch_ = bSwitch; }
-      inline bool getSwitch() const
-        { return this->bSwitch_; }
-
-      inline void setStayActive(bool bStayActive)
-        { this->bStayActive_ = bStayActive; }
-      inline bool getStayActive() const
-        { return this->bStayActive_; }
-
-      inline void setActivations(int activations)
-        { this->remainingActivations_ = activations; }
-      inline int getActivations() const
-        { return this->remainingActivations_; }
-
       inline void setVisible(bool visibility)
         { this->debugBillboard_.setVisible(visibility); }
 
-      void setDelay(float delay);
-      inline float getDelay() const
-        { return this->delay_; }
+      void delayChanged(void);
 
       bool switchState();
 
@@ -114,19 +88,10 @@
       bool checkXor();
       void setBillboardColour(const ColourValue& colour);
       void storeState();
-      std::string getModeString() const;
 
       bool bActive_;
       bool bTriggered_;
-      bool bFirstTick_;
 
-      TriggerMode::Value mode_;
-      bool bInvertMode_;
-      bool bSwitch_;
-      bool bStayActive_;
-      float delay_;
-      int remainingActivations_;
-
       char latestState_;
       float remainingTime_;
       float timeSinceLastEvent_;
@@ -134,7 +99,6 @@
 //      bool bUpdating_;
       BillboardSet debugBillboard_;
 
-      std::set<Trigger*> children_;
       std::queue<std::pair<float, char> > stateChanges_;
   };
 

Added: code/trunk/src/modules/objects/triggers/TriggerBase.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/TriggerBase.cc	                        (rev 0)
+++ code/trunk/src/modules/objects/triggers/TriggerBase.cc	2010-10-30 11:54:49 UTC (rev 7601)
@@ -0,0 +1,189 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file TriggerBase.cc
+    @brief Implementation of the TriggerBase class.
+    @ingroup Triggers
+*/
+
+#include "TriggerBase.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox {
+
+    // Initialization of some static (magic) variables.
+    /*static*/ const int TriggerBase::INF_s = -1;
+    /*static*/ const std::string TriggerBase::and_s = "and";
+    /*static*/ const std::string TriggerBase::or_s = "or";
+    /*static*/ const std::string TriggerBase::xor_s = "xor";
+
+    CreateFactory(TriggerBase);
+
+    /**
+    @brief
+        Constructor. Registers the object and initializes some values.
+    */
+    TriggerBase::TriggerBase(BaseObject* creator) : StaticEntity(creator)
+    {
+        RegisterObject(TriggerBase);
+
+        this->bFirstTick_ = true;
+
+        this->delay_ = 0.0f;
+        this->bSwitch_ = false;
+        this->bStayActive_ = false;
+
+        this->remainingActivations_ = INF_s;
+
+        this->bInvertMode_ = false;
+        this->mode_ = TriggerMode::EventTriggerAND;
+
+        this->parent_ = NULL;
+
+        this->bMultiTrigger_ = false;
+
+        this->setSyncMode(0x0);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    TriggerBase::~TriggerBase()
+    {
+        
+    }
+
+    /**
+    @brief
+        Method for creating a TriggerBase object through XML.
+        For a detailed description of the parameters please see the class description in the header file.
+    */
+    void TriggerBase::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(TriggerBase, XMLPort, xmlelement, mode);
+
+        XMLPortParam(TriggerBase, "delay", setDelay, getDelay, xmlelement, mode);
+        XMLPortParam(TriggerBase, "switch", setSwitch, getSwitch, xmlelement, mode);
+        XMLPortParam(TriggerBase, "stayactive", setStayActive, getStayActive, xmlelement, mode);
+        XMLPortParam(TriggerBase, "activations", setActivations, getActivations, xmlelement, mode);
+        XMLPortParam(TriggerBase, "invert", setInvert, getInvert, xmlelement, mode);
+        XMLPortParamTemplate(TriggerBase, "mode", setMode, getModeString, xmlelement, mode, const std::string&);
+
+        XMLPortObject(TriggerBase, TriggerBase, "", addTrigger, getTrigger, xmlelement, mode);
+    }
+
+    /**
+    @brief
+        A method that is executed each tick.
+    @param dt
+        The duration of the last tick.
+    */
+    void TriggerBase::tick(float dt)
+    {
+        SUPER(TriggerBase, tick, dt);
+    }
+
+    /**
+    @brief
+        Set the mode of the trigger.
+    @param modeName
+        The name of the mode as a string.
+    */
+    void TriggerBase::setMode(const std::string& modeName)
+    {
+        if (modeName == TriggerBase::and_s)
+            this->setMode(TriggerMode::EventTriggerAND);
+        else if (modeName == TriggerBase::or_s)
+            this->setMode(TriggerMode::EventTriggerOR);
+        else if (modeName == TriggerBase::xor_s)
+            this->setMode(TriggerMode::EventTriggerXOR);
+        else
+            COUT(2) << "Invalid mode '" << modeName << "' in TriggerBase " << this->getName() << " &(" << this << "). Leaving mode at '" << this->getModeString() << "'." << std::endl;
+    }
+
+    /**
+    @brief
+        Get the mode of the MultiTrigger.
+    @return
+        Returns the mode as a string.
+    */
+    const std::string& TriggerBase::getModeString(void) const
+    {
+        if (this->mode_ == TriggerMode::EventTriggerAND)
+            return TriggerBase::and_s;
+        else if (this->mode_ == TriggerMode::EventTriggerOR)
+            return TriggerBase::or_s;
+        else if (this->mode_ == TriggerMode::EventTriggerXOR)
+            return TriggerBase::xor_s;
+        else // This can never happen, but the compiler needs it to feel secure.
+            return TriggerBase::and_s;
+    }
+
+    /**
+    @brief
+        Adds a trigger as a child to the trigger.
+        Beware: Loops are not prevented and potentially very bad, so just don't create any loops.
+    @param trigger
+        The trigger to be added.
+    */
+    void TriggerBase::addTrigger(TriggerBase* trigger)
+    {
+        assert(trigger);
+        if (this != trigger)
+            this->children_.insert(trigger);
+        trigger->addParentTrigger(this);
+    }
+
+    /**
+    @brief
+        Get the child of this trigger at the given index.
+    @param index
+        The index.
+    @return
+        Returns a pointer ot the trigger. NULL if no such trigger exists.
+    */
+    const TriggerBase* TriggerBase::getTrigger(unsigned int index) const
+    {
+        // If the index is greater than the number of children.
+        if (this->children_.size() <= index)
+            return NULL;
+
+        std::set<TriggerBase*>::const_iterator it;
+        it = this->children_.begin();
+
+        for (unsigned int i = 0; i != index; ++i)
+            ++it;
+
+        return (*it);
+    }
+
+}

Added: code/trunk/src/modules/objects/triggers/TriggerBase.h
===================================================================
--- code/trunk/src/modules/objects/triggers/TriggerBase.h	                        (rev 0)
+++ code/trunk/src/modules/objects/triggers/TriggerBase.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -0,0 +1,214 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file TriggerBase.h
+    @brief Definition of the TriggerBase class.
+    @ingroup Triggers
+*/
+
+#ifndef _TriggerBase_H__
+#define _TriggerBase_H__
+
+#include "objects/ObjectsPrereqs.h"
+
+#include <set>
+#include <string>
+
+#include "tools/interfaces/Tickable.h"
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox {
+
+    /**
+    @brief
+        The different modes the trigger can be in.
+
+    @ingroup Triggers
+    */
+    namespace TriggerMode
+    {
+        enum Value
+        {
+            EventTriggerAND, //!< The <em>and</em> mode. The trigger can only trigger if all the children are active. 
+            EventTriggerOR, //!< The <em>or</em> mode. The trigger can only trigger if at least one child is active.
+            EventTriggerXOR, //!< The <em>xor</em> mode. The trigger can only trigger if exactly one child is active. 
+        };
+    }
+
+    /**
+    @brief
+        The TriggerBase class is a base class for the two types of triggers, the (normal) @ref orxonox::Trigger "Triggers" and the @ref orxonox::MultiTrigger "MultiTriggers", it encompasses the shared data and functionality between these two types of triggers, but is in itself not a trigger that has any meaningful behaviour and thus should not be instantiated.
+
+    @author
+        Damian 'Mozork' Frick
+
+    @ingroup Triggers
+    */
+    class _ObjectsExport TriggerBase : public StaticEntity, public Tickable
+    {
+        public:
+            TriggerBase(BaseObject* creator);
+            virtual ~TriggerBase();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< Method for creating a TriggerBase object through XML.
+            virtual void tick(float dt); //!< A method that is executed each tick.
+
+            /**
+            @brief Check whether the trigger is active.
+            @return Returns if the trigger is active.
+            */
+            virtual bool isActive(void) const
+                { return false; }
+
+            /**
+            @brief Set the delay of the trigger.
+            @param delay The delay to be set.
+            */
+            inline void setDelay(float delay)
+                { if(delay > 0.0f) this->delay_= delay; this->delayChanged(); }
+            /**
+            @brief Get the delay of the trigger.
+            @return The delay.
+            */
+            inline float getDelay(void) const
+                { return this->delay_; }
+            virtual void delayChanged(void) {}
+
+            /**
+            @brief Set switch-mode of the trigger.
+            @param bSwitch If true the trigger is set to switched.
+            */
+            inline void setSwitch(bool bSwitch)
+                { this->bSwitch_ = bSwitch; }
+            /**
+            @brief Get the switch-mode of the trigger.
+            @return Returns true if the trigger is in switch-mode.
+            */
+            inline bool getSwitch(void) const
+                { return this->bSwitch_; }
+
+            /**
+            @brief Set the stay-active-mode of the trigger.
+            @param bStayActive If true the trigger is set to stay active.
+            */
+            inline void setStayActive(bool bStayActive)
+                { this->bStayActive_ = bStayActive; }
+            /**
+            @brief Get the stay-active-mode of the trigger.
+            @return Returns true if the trigger stays active.
+            */
+            inline bool getStayActive(void) const
+                { return this->bStayActive_; }
+
+            /**
+            @brief Get the number of remaining activations of the trigger.
+            @return The number of activations. -1 denotes infinity.
+            */
+            inline int getActivations(void) const
+                { return this->remainingActivations_; }
+
+            /**
+            @brief Set the invert-mode of triggerhe trigger.
+            @param bInvert If true the t is set to invert.
+            */
+            inline void setInvert(bool bInvert)
+                { this->bInvertMode_ = bInvert; }
+            /**
+            @brief Get the invert-mode of the trigger.
+            @return Returns true if the trigger is set to invert.
+            */
+            inline bool getInvert(void) const
+                { return this->bInvertMode_; }
+
+            void setMode(const std::string& modeName); //!< Set the mode of the trigger.
+            /**
+            @brief Set the mode of the trigger.
+            @param mode The mode of the trigger.
+            */
+            inline void setMode(TriggerMode::Value mode) //!< Get the mode of the trigger.
+                { this->mode_ = mode; }
+            const std::string& getModeString(void) const;
+            /**
+            @brief Get the mode of the trigger.
+            @return Returns and Enum for the mode of the trigger.
+            */
+            inline TriggerMode::Value getMode(void) const
+                { return mode_; }
+
+            void addTrigger(TriggerBase* trigger);
+            const TriggerBase* getTrigger(unsigned int index) const;
+
+            /**
+            @brief Check whether this trigger is a @ref orxonox::MultiTrigger "MultiTrigger".
+                This is done for performance reasons.
+            */
+            inline bool isMultiTrigger(void)
+                { return this->bMultiTrigger_; }
+
+        protected:
+            static const int INF_s; //!< Magic number for infinity.
+            //! Magic strings for the mode.
+            static const std::string and_s;
+            static const std::string or_s;
+            static const std::string xor_s;
+
+            /**
+            @brief Set the number of activations the trigger can go through.
+            @param activations The number of activations. -1 denotes infinitely many activations.
+            */
+            inline void setActivations(int activations)
+                { if(activations >= 0 || activations == INF_s) this->remainingActivations_ = activations; }
+
+            /**
+            @brief Adds the parent of a MultiTrigger.
+            @param parent A pointer to the parent MultiTrigger.
+            */
+            inline void addParentTrigger(TriggerBase* parent)
+                { this->parent_ = parent; }
+
+            bool bFirstTick_; //!< Bool to check whether this is the first tick.
+
+            float delay_; //!< The delay that is imposed on all new trigger events.
+            bool bSwitch_; //!< Bool for the switch-mode, if true the trigger behaves like a switch.
+            bool bStayActive_; //!< Bool for the stay-active-mode, if true the trigger stays active after its last activation.;
+
+            int remainingActivations_; //!< The remaining activations of this trigger.
+
+            bool bInvertMode_; //!< Bool for the invert-mode, if true the trigger is inverted.
+            TriggerMode::Value mode_; //!< The mode of the trigger.
+
+            TriggerBase* parent_; //!< The parent of this trigger.
+            std::set<TriggerBase*> children_; //!< The children of this trigger.
+
+            bool bMultiTrigger_; //!< Specifies whether this trigger is a MultiTrigger.
+
+    };
+}
+
+#endif /* _Trigger_H__ */

Modified: code/trunk/src/orxonox/interfaces/PlayerTrigger.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PlayerTrigger.h	2010-10-28 21:53:27 UTC (rev 7600)
+++ code/trunk/src/orxonox/interfaces/PlayerTrigger.h	2010-10-30 11:54:49 UTC (rev 7601)
@@ -27,24 +27,28 @@
  */
 
 /**
-    @file
-    @brief
-    Definition of the PlayerTrigger class.
+    @file PlayerTrigger.h
+    @brief Definition of the PlayerTrigger class.
+    @ingroup Triggers
 */
 
 #ifndef _PlayerTrigger_H__
 #define _PlayerTrigger_H__
 
 #include "OrxonoxPrereqs.h"
+
 #include "core/OrxonoxClass.h"
 
 namespace orxonox
 {
     /**
     @brief
-        A PlayerTrigger is a trigger which is normally triggered by Pawns and can as such return a pointer to the Pawn which triggered it.
+        PlayerTrigger is an interface if implemented by a specific trigger can be used to recover the Player (or more precisely the @ref orxonox::Pawn "Pawn") that triggered it.
+
     @author
         Damian 'Mozork' Frick
+
+    @ingroup Triggers
     */
     class _OrxonoxExport PlayerTrigger : virtual public OrxonoxClass
     {
@@ -74,10 +78,10 @@
         inline void setTriggeringPlayer(Pawn* player)
            { this->player_ = player; }
 
-            /**
-            @brief Set whether the PlayerTrigger normally is triggered by Pawns.
-            @param isForPlayer Should be true when the PlayerTrigger should be set to normally be triggered by Pawns, false if not.
-            */
+        /**
+        @brief Set whether the PlayerTrigger normally is triggered by Pawns.
+        @param isForPlayer Should be true when the PlayerTrigger should be set to normally be triggered by Pawns, false if not.
+        */
         inline void setForPlayer(bool isForPlayer)
            { this->isForPlayer_ = isForPlayer; }
 




More information about the Orxonox-commit mailing list