Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 19, 2011, 4:01:34 PM (13 years ago)
Author:
anbueche
Message:

added reenter delay, added comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/portals2/src/modules/portals/PortalEndPoint.h

    r8466 r8511  
    1818#include "objects/triggers/DistanceMultiTrigger.h"
    1919#include "core/EventIncludes.h"
     20#include <ctime>
    2021
    2122namespace orxonox
     
    4142            void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    4243            static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint
     44            inline void setReenterDelay(unsigned int seconds)
     45            {
     46                this->reenterDelay_ = seconds;
     47            }
     48            inline unsigned int getReenterDelay()
     49            {
     50                return this->reenterDelay_;
     51            }
    4352            inline void setID(unsigned int id)
    4453            {
     
    6574
    6675            /*! \brief This function is called each time the DistanceMultiTrigger of this PortalEndPoint changed
    67              * \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
    68              * \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
    69              *
    70              * if bTriggered is \c true the triggering entity enters this portal (if it is an entrance)
    71              * otherwise the triggering entity is removed from the set of entities who recently jumped out of this portal */
     76                \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
     77                \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
     78            */
    7279            bool execute(bool bTriggered, BaseObject* trigger);
    7380
     
    7582             * \param entity The Entity which should jump out of this portal */
    7683            void jumpOut(MobileEntity * entity);
     84           
     85            /** \brief Tells wether a certain Entity is allowed to enter the PortalEndPoint?
     86                @return @c true if the entity not just came out of this portal and the reenterDelay has expired for it, @c false otherwise
     87            */
     88            bool letsEnter(MobileEntity* entity);
    7789        protected:
    7890           
     
    8496            std::string templateName_;            //!< The name of the design template used for this endpoint
    8597
    86             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
     98            int reenterDelay_;
     99            std::map<MobileEntity *, time_t> jumpOutTimes_;   //!< Stores the time at which a certain MobileEntity @ref jumpOut "jumped out" of this PortalEndPoint
     100            std::set<MobileEntity *> recentlyJumpedOut_;
    87101    };
    88102
Note: See TracChangeset for help on using the changeset viewer.