Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/portals/PortalLink.h @ 11565

Last change on this file since 11565 was 11071, checked in by landauf, 9 years ago

merged branch cpp11_v3 back to trunk

  • Property svn:eol-style set to native
File size: 3.0 KB
RevLine 
[8706]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Andreas Büchel
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file PortalLink.h
31    @brief Declaration of the PortalLink class
32    @ingroup Portals
33 */
34
[8177]35#ifndef _PortalLink_H__
36#define _PortalLink_H__
37
[8200]38#include "portals/PortalsPrereqs.h"
[8177]39
[8243]40#include <map>
[8177]41
[8767]42#include "PortalEndPoint.h"
43
44#include "core/BaseObject.h"
45
[8177]46namespace orxonox
47{
[8706]48    /**
49        @brief
50            A PortalLink represents the connection between two @ref orxonox::PortalEndPoint "PortalEndPoints"
51        @ingroup Portals
52     */
[8243]53    class _PortalsExport PortalLink : public BaseObject
[8177]54    {
55        public:
[9667]56            PortalLink(Context* context);
[8177]57            virtual ~PortalLink();
[11071]58            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
[8767]59
[8455]60            inline void setFromID(unsigned int from)    //!< set the ID of the PortalEndPoint which should act as the entrance of this link
[8767]61                { this->fromID_ = from; }
[8177]62            inline unsigned int getFromID(unsigned int) const
[8767]63                { return this->fromID_; }
[8455]64            inline void setToID(unsigned int to)     //!< set the ID of the PortalEndPoint which should act as the exit of this link
[8767]65                { this->toID_ = to; }
[8177]66            inline unsigned int getToID(unsigned int) const
[8767]67                { return this->toID_; }
[8706]68            /*! \brief Let an entity enter a certain PortalEndPoint
69                \param entity pointer to the entity which is entering a PortalEndPoint
70                \param entrance pointer to the PortalEndPoint to enter
71             */
72            static void use(MobileEntity * entity, PortalEndPoint * entrance);   //!< let entity enter the PortalEndPoint pointed to by entrance
[8177]73        protected:
74        private:
[8706]75            static std::map<PortalEndPoint *, PortalEndPoint *> links_s;   //!< maps entrances to exits
76            unsigned int fromID_;   //!< id of the entrance of this Link
77            unsigned int toID_;   //!< id of the exit of this Link
78            PortalEndPoint* from_;   //!< pointer to this Link's entrance
79            PortalEndPoint* to_;   //!< pointer to this Link's exit
[8177]80    };
81}
82
[8200]83#endif /* _Portals_H__ */
Note: See TracBrowser for help on using the repository browser.