Index: code/trunk/src/modules/portals/PortalEndPoint.cc
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.cc	(revision 8706)
+++ code/trunk/src/modules/portals/PortalEndPoint.cc	(revision 8767)
@@ -28,14 +28,20 @@
 
 #include "PortalEndPoint.h"
+
+#include <ctime>
+
+#include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
+
+#include "worldentities/MobileEntity.h"
+
 #include "objects/triggers/MultiTriggerContainer.h"
+
 #include "portals/PortalLink.h"
-#include "worldentities/MobileEntity.h"
-#include <ctime>
 
 namespace orxonox
 {
     CreateFactory(PortalEndPoint);
-    
+
     /*static*/ const std::string PortalEndPoint::EVENTFUNCTIONNAME = "execute";
 
@@ -45,8 +51,8 @@
     {
         RegisterObject(PortalEndPoint);
-        
+
         this->trigger_ = new DistanceMultiTrigger(this);
         this->trigger_->setName("portal");
-        this->attach(trigger_);
+        this->attach(this->trigger_);
 
         this->setRadarObjectColour(ColourValue::White);
@@ -54,5 +60,5 @@
         this->setRadarVisibility(true);
     }
-    
+
     PortalEndPoint::~PortalEndPoint()
     {
@@ -64,5 +70,5 @@
     {
         SUPER(PortalEndPoint, XMLPort, xmlelement, mode);
-        
+
         XMLPortParam(PortalEndPoint, "id", setID, getID, xmlelement, mode);
         XMLPortParam(PortalEndPoint, "design", setTemplate, getTemplate, xmlelement, mode);
@@ -70,8 +76,8 @@
         XMLPortParamExtern(PortalEndPoint, DistanceMultiTrigger, this->trigger_, "distance", setDistance, getDistance, xmlelement, mode);
         XMLPortParamLoadOnly(PortalEndPoint, "target", setTarget, xmlelement, mode).defaultValues("Pawn");
-        
+
         // Add the DistanceMultiTrigger as event source.
         this->addEventSource(this->trigger_, EVENTFUNCTIONNAME);
-        
+
         if(mode == XMLPort::LoadObject)
         {
@@ -83,5 +89,5 @@
     {
         SUPER(PortalEndPoint, XMLEventPort, xmlelement, mode);
-        
+
         XMLPortEventSink(PortalEndPoint, BaseObject, EVENTFUNCTIONNAME, execute, xmlelement, mode);
     }
@@ -91,9 +97,9 @@
         if(!this->isActive())
             return true;
-        
+
         MultiTriggerContainer * cont = orxonox_cast<MultiTriggerContainer *>(trigger);
         if(cont == 0)
             return true;
-        
+
         DistanceMultiTrigger * originatingTrigger = orxonox_cast<DistanceMultiTrigger *>(cont->getOriginator());
         if(originatingTrigger == 0)
@@ -101,9 +107,9 @@
             return true;
         }
-        
+
         MobileEntity * entity = orxonox_cast<MobileEntity *>(cont->getData());
         if(entity == 0)
             return true;
-        
+
         if(bTriggered)
         {
@@ -117,5 +123,5 @@
             this->recentlyJumpedOut_.erase(entity);
         }
-        
+
         return true;
     }
@@ -124,5 +130,5 @@
     {
         SUPER(PortalEndPoint, changedActivity);
-        
+
         this->setRadarVisibility(this->isActive());
     }
Index: code/trunk/src/modules/portals/PortalEndPoint.h
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.h	(revision 8706)
+++ code/trunk/src/modules/portals/PortalEndPoint.h	(revision 8767)
@@ -38,14 +38,13 @@
 #include "portals/PortalsPrereqs.h"
 
+#include <map>
 #include <set>
 #include <string>
-#include <map>
+
+#include "core/EventIncludes.h"
 
 #include "worldentities/StaticEntity.h"
 #include "interfaces/RadarViewable.h"
-#include "graphics/Billboard.h"
 #include "objects/triggers/DistanceMultiTrigger.h"
-#include "core/EventIncludes.h"
-#include <ctime>
 
 namespace orxonox
@@ -54,8 +53,8 @@
      @brief
      A PortalEndPoint serves as portal entrance and/or exit.
-     
+
      @ingroup Portals
      */
-    
+
     class _PortalsExport PortalEndPoint : public StaticEntity, public RadarViewable
     {
@@ -63,11 +62,11 @@
             PortalEndPoint(BaseObject* creator);
             virtual ~PortalEndPoint();
-            
+
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             virtual void changedActivity(void);
-            
+
             inline void setTarget(const std::string & target)                 //!< add types which are allowed to activate the PortalEndPoint
                 { this->trigger_->addTarget(target); }
-            
+
             void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
             static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint
@@ -78,8 +77,8 @@
             inline void setID(unsigned int id)
                 { this->id_ = id; }
-            
+
             inline unsigned int getID() const
                 { return this->id_; }
-            
+
             /// \brief Set templateName_ (the name of the design Template) and add that Template to this Object
             inline void setTemplate(const std::string & name)
@@ -99,5 +98,5 @@
              * \param entity The Entity which should jump out of this portal */
             void jumpOut(MobileEntity * entity);
-            
+
             /** \brief Tells wether a certain Entity is allowed to enter the PortalEndPoint?
                 @return @c true if the entity not just came out of this portal and the reenterDelay has expired for it, @c false otherwise
@@ -105,8 +104,8 @@
             bool letsEnter(MobileEntity* entity);
         protected:
-            
+
         private:
             static const std::string EVENTFUNCTIONNAME; //!< = "execute"
-            
+
             unsigned int id_;            //!< the hopefully (depends on the writer of the levelfile) unique id, which is used to establish links between PortalEndPoints
             DistanceMultiTrigger * trigger_;      //!< the DistanceMultiTrigger which notices near entities of the defined type
Index: code/trunk/src/modules/portals/PortalLink.cc
===================================================================
--- code/trunk/src/modules/portals/PortalLink.cc	(revision 8706)
+++ code/trunk/src/modules/portals/PortalLink.cc	(revision 8767)
@@ -28,6 +28,8 @@
 
 #include "PortalLink.h"
+
+#include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
-#include "objects/triggers/MultiTriggerContainer.h"
+
 #include "worldentities/MobileEntity.h"
 
@@ -37,15 +39,15 @@
 
     std::map<PortalEndPoint *, PortalEndPoint *> PortalLink::links_s;
-    
+
     PortalLink::PortalLink(BaseObject* creator) : BaseObject(creator), fromID_(0), toID_(0), from_(0), to_(0)
     {
         RegisterObject(PortalLink);
     }
-    
+
     PortalLink::~PortalLink()
     {
-        
+
     }
-    
+
     void PortalLink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
@@ -54,4 +56,5 @@
         XMLPortParam(PortalLink, "toID", setToID, getToID, xmlelement, mode);
 
+        // Beware: This means, that the PortalEndPoints must exist before the PortalLink is created.
         if(mode == XMLPort::LoadObject)
         {
@@ -65,10 +68,7 @@
     {
         if(entrance == 0)
-        {
             return;
-        }
-        
+
         std::map<PortalEndPoint *, PortalEndPoint *>::iterator endpoints = PortalLink::links_s.find(entrance);
-        
         if(endpoints == PortalLink::links_s.end())  // entrance has no corresponding exit
             return;
Index: code/trunk/src/modules/portals/PortalLink.h
===================================================================
--- code/trunk/src/modules/portals/PortalLink.h	(revision 8706)
+++ code/trunk/src/modules/portals/PortalLink.h	(revision 8767)
@@ -37,10 +37,10 @@
 
 #include "portals/PortalsPrereqs.h"
-#include "tools/interfaces/Tickable.h"
-#include "core/BaseObject.h"
-#include "PortalEndPoint.h"
-#include "objects/eventsystem/EventListener.h"
 
 #include <map>
+
+#include "PortalEndPoint.h"
+
+#include "core/BaseObject.h"
 
 namespace orxonox
@@ -57,20 +57,13 @@
             virtual ~PortalLink();
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
             inline void setFromID(unsigned int from)    //!< set the ID of the PortalEndPoint which should act as the entrance of this link
-            {
-                this->fromID_ = from;
-            }
+                { this->fromID_ = from; }
             inline unsigned int getFromID(unsigned int) const
-            {
-                return this->fromID_;
-            }
+                { return this->fromID_; }
             inline void setToID(unsigned int to)     //!< set the ID of the PortalEndPoint which should act as the exit of this link
-            {
-                this->toID_ = to;
-            }
+                { this->toID_ = to; }
             inline unsigned int getToID(unsigned int) const
-            {
-                return this->toID_;
-            }
+                { return this->toID_; }
             /*! \brief Let an entity enter a certain PortalEndPoint
                 \param entity pointer to the entity which is entering a PortalEndPoint
