Index: code/trunk/src/modules/portals/PortalEndPoint.cc
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.cc	(revision 8471)
+++ code/trunk/src/modules/portals/PortalEndPoint.cc	(revision 8706)
@@ -1,2 +1,30 @@
+/*
+ *   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:
+ *      Andreas Büchel
+ *   Co-authors:
+ *      ...
+ *
+ */
+
 #include "PortalEndPoint.h"
 #include "core/XMLPort.h"
@@ -4,5 +32,5 @@
 #include "portals/PortalLink.h"
 #include "worldentities/MobileEntity.h"
-
+#include <ctime>
 
 namespace orxonox
@@ -14,15 +42,21 @@
     std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s;
 
-    PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), id_(0), trigger_(NULL)
+    PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), RadarViewable(creator, static_cast<WorldEntity*>(this)), id_(0), trigger_(NULL), reenterDelay_(0)
     {
         RegisterObject(PortalEndPoint);
+        
         this->trigger_ = new DistanceMultiTrigger(this);
         this->trigger_->setName("portal");
         this->attach(trigger_);
+
+        this->setRadarObjectColour(ColourValue::White);
+        this->setRadarObjectShape(RadarViewable::Dot);
+        this->setRadarVisibility(true);
     }
     
     PortalEndPoint::~PortalEndPoint()
     {
-        delete this->trigger_;
+        if(this->isInitialized() && this->trigger_ != NULL)
+            delete this->trigger_;
     }
 
@@ -33,4 +67,5 @@
         XMLPortParam(PortalEndPoint, "id", setID, getID, xmlelement, mode);
         XMLPortParam(PortalEndPoint, "design", setTemplate, getTemplate, xmlelement, mode);
+        XMLPortParam(PortalEndPoint, "reenterDelay", setReenterDelay, getReenterDelay, xmlelement, mode);
         XMLPortParamExtern(PortalEndPoint, DistanceMultiTrigger, this->trigger_, "distance", setDistance, getDistance, xmlelement, mode);
         XMLPortParamLoadOnly(PortalEndPoint, "target", setTarget, xmlelement, mode).defaultValues("Pawn");
@@ -64,5 +99,4 @@
         if(originatingTrigger == 0)
         {
-            COUT(1) << "originator no DistanceMultiTrigger\n" << std::endl;
             return true;
         }
@@ -74,5 +108,5 @@
         if(bTriggered)
         {
-            if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end())  // only enter the portal if not just jumped out of it
+            if(this->letsEnter(entity))  // only enter the portal if not just (this very moment) jumped out of it, or if the reenterDelay expired
             {
                 PortalLink::use(entity, this);
@@ -87,12 +121,35 @@
     }
 
+    void PortalEndPoint::changedActivity(void)
+    {
+        SUPER(PortalEndPoint, changedActivity);
+        
+        this->setRadarVisibility(this->isActive());
+    }
+
+    bool PortalEndPoint::letsEnter(MobileEntity* entity)
+    {
+        // not allowed to enter if reenterDelay hasn't expired yet
+        std::map<MobileEntity *, time_t>::const_iterator time = this->jumpOutTimes_.find(entity);
+        if(time != this->jumpOutTimes_.end() && std::difftime(std::time(0),time->second) < this->reenterDelay_)
+            return false;
+
+        // not allowed to enter if jumped out of this portal and not left its activation radius yet
+        std::set<MobileEntity *>::const_iterator recent = this->recentlyJumpedOut_.find(entity);
+        if(recent != this->recentlyJumpedOut_.end())
+            return false;
+        
+        return true;
+    }
+
     void PortalEndPoint::jumpOut(MobileEntity* entity)
     {
+        this->jumpOutTimes_[entity] = std::time(0);
         this->recentlyJumpedOut_.insert(entity);
-        
+
+        // adjust
         entity->setPosition(this->getWorldPosition());
         entity->rotate(this->getWorldOrientation());
         entity->setVelocity(this->getWorldOrientation() * entity->getVelocity());
-        entity->setVelocity(entity->getVelocity() * 1.5);
     }
 
Index: code/trunk/src/modules/portals/PortalEndPoint.h
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.h	(revision 8471)
+++ code/trunk/src/modules/portals/PortalEndPoint.h	(revision 8706)
@@ -1,2 +1,36 @@
+/*
+ *   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:
+ *      Andreas Büchel
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ *  @file PortalEndPoint.h
+ *  @brief Declaration of the PortalEndPoint class.
+ *  @ingroup Portals
+ */
+
 #ifndef _PortalEndPoint_H__
 #define _PortalEndPoint_H__
@@ -9,52 +43,55 @@
 
 #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
 {
-    class _PortalsExport PortalEndPoint : public StaticEntity
+    /**
+     @brief
+     A PortalEndPoint serves as portal entrance and/or exit.
+     
+     @ingroup Portals
+     */
+    
+    class _PortalsExport PortalEndPoint : public StaticEntity, public RadarViewable
     {
         public:
             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);
-            }
+                { 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
+            inline void setReenterDelay(unsigned int seconds)
+                { this->reenterDelay_ = seconds; }
+            inline unsigned int getReenterDelay()
+                { return this->reenterDelay_; }
             inline void setID(unsigned int id)
-            {
-                this->id_ = id;
-            }
+                { this->id_ = id; }
             
             inline unsigned int getID() const
-            {
-                return this->id_;
-            }
+                { 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)
-            {
-                this->templateName_ = name;
-                this->addTemplate(name);
-            }
+                { this->templateName_ = name; this->addTemplate(name); }
 
             /// \brief Get the name of the attached design template
             inline const std::string & getTemplate()
-            {
-                return this->templateName_;
-            }
+                { return this->templateName_; }
 
             /*! \brief This function is called each time the DistanceMultiTrigger of this PortalEndPoint changed
-             * \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
-             * \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
-             * 
-             * if bTriggered is \c true the triggering entity enters this portal (if it is an entrance)
-             * otherwise the triggering entity is removed from the set of entities who recently jumped out of this portal */
+                \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
+                \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
+            */
             bool execute(bool bTriggered, BaseObject* trigger);
 
@@ -62,4 +99,9 @@
              * \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
+            */
+            bool letsEnter(MobileEntity* entity);
         protected:
             
@@ -71,5 +113,7 @@
             std::string templateName_;            //!< The name of the design template used for this endpoint
 
-            std::set<MobileEntity *> recentlyJumpedOut_; //!< Entities which recently jumped out of this EndPoint, hence they shouldn't be pulled in again if the endpoint is the beginning of a link
+            int reenterDelay_;
+            std::map<MobileEntity *, time_t> jumpOutTimes_;   //!< Stores the time at which a certain MobileEntity @ref jumpOut "jumped out" of this PortalEndPoint
+            std::set<MobileEntity *> recentlyJumpedOut_;   //!< Stores the entities witch recently jumped out of this PortalEndPoint and haven't left the activation radius yet. This is needed in order to prevent them from beeing pulled into the PortalEndPoint they have just come out of.
     };
 
Index: code/trunk/src/modules/portals/PortalLink.cc
===================================================================
--- code/trunk/src/modules/portals/PortalLink.cc	(revision 8471)
+++ code/trunk/src/modules/portals/PortalLink.cc	(revision 8706)
@@ -1,2 +1,30 @@
+/*
+ *   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:
+ *      Andreas Büchel
+ *   Co-authors:
+ *      ...
+ *
+ */
+
 #include "PortalLink.h"
 #include "core/XMLPort.h"
@@ -17,4 +45,5 @@
     PortalLink::~PortalLink()
     {
+        
     }
     
@@ -37,16 +66,13 @@
         if(entrance == 0)
         {
-            // TODO COUT
             return;
         }
         
-        std::map<PortalEndPoint *, PortalEndPoint *>::iterator endpoint = PortalLink::links_s.find(entrance);
+        std::map<PortalEndPoint *, PortalEndPoint *>::iterator endpoints = PortalLink::links_s.find(entrance);
         
-        if(endpoint == PortalLink::links_s.end())  // entrance has no corresponding exit
+        if(endpoints == PortalLink::links_s.end())  // entrance has no corresponding exit
             return;
-        
-        endpoint->second->jumpOut(entity);
+
+        endpoints->second->jumpOut(entity);
     }
-
-
 }
Index: code/trunk/src/modules/portals/PortalLink.h
===================================================================
--- code/trunk/src/modules/portals/PortalLink.h	(revision 8471)
+++ code/trunk/src/modules/portals/PortalLink.h	(revision 8706)
@@ -1,2 +1,36 @@
+/*
+ *   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:
+ *      Andreas Büchel
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file PortalLink.h
+    @brief Declaration of the PortalLink class
+    @ingroup Portals
+ */
+
 #ifndef _PortalLink_H__
 #define _PortalLink_H__
@@ -12,4 +46,9 @@
 namespace orxonox
 {
+    /**
+        @brief
+            A PortalLink represents the connection between two @ref orxonox::PortalEndPoint "PortalEndPoints"
+        @ingroup Portals
+     */
     class _PortalsExport PortalLink : public BaseObject
     {
@@ -34,16 +73,17 @@
                 return this->toID_;
             }
-            static void use(MobileEntity * entity, PortalEndPoint * entrance);   //
+            /*! \brief Let an entity enter a certain PortalEndPoint
+                \param entity pointer to the entity which is entering a PortalEndPoint
+                \param entrance pointer to the PortalEndPoint to enter
+             */
+            static void use(MobileEntity * entity, PortalEndPoint * entrance);   //!< let entity enter the PortalEndPoint pointed to by entrance
         protected:
         private:
-            static std::map<PortalEndPoint *, PortalEndPoint *> links_s;
-            unsigned int fromID_;
-            unsigned int toID_;
-            PortalEndPoint* from_;
-            PortalEndPoint* to_;
-            float activationRadius_;
-            bool isNowPortable(WorldEntity * ent);
+            static std::map<PortalEndPoint *, PortalEndPoint *> links_s;   //!< maps entrances to exits
+            unsigned int fromID_;   //!< id of the entrance of this Link
+            unsigned int toID_;   //!< id of the exit of this Link
+            PortalEndPoint* from_;   //!< pointer to this Link's entrance
+            PortalEndPoint* to_;   //!< pointer to this Link's exit
     };
-
 }
 
