Orxonox  0.0.5 Codename: Arcturus
PortalEndPoint.h
Go to the documentation of this file.
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 
35 #ifndef _PortalEndPoint_H__
36 #define _PortalEndPoint_H__
37 
38 #include "portals/PortalsPrereqs.h"
39 
40 #include <map>
41 #include <set>
42 #include <string>
43 
44 #include "core/EventIncludes.h"
45 
49 
50 namespace orxonox
51 {
60  {
61  public:
62  PortalEndPoint(Context* context);
63  virtual ~PortalEndPoint();
64 
65  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
66  virtual void changedActivity(void) override;
67 
68  inline void setTarget(const std::string & target)
69  { this->trigger_->addTarget(target); }
70 
71  virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
72  static std::map<unsigned int, PortalEndPoint *> idMap_s;
73  inline void setReenterDelay(unsigned int seconds)
74  { this->reenterDelay_ = seconds; }
75  inline unsigned int getReenterDelay()
76  { return this->reenterDelay_; }
77  inline void setID(unsigned int id)
78  { this->id_ = id; }
79 
80  inline unsigned int getID() const
81  { return this->id_; }
82 
84  inline void setTemplate(const std::string & name)
85  { this->templateName_ = name; this->addTemplate(name); }
86 
88  inline const std::string & getTemplate()
89  { return this->templateName_; }
90 
95  bool execute(bool bTriggered, BaseObject* trigger);
96 
99  void jumpOut(MobileEntity * entity);
100 
104  bool letsEnter(MobileEntity* entity);
105  protected:
106 
107  private:
109 
110  unsigned int id_;
113 
115  std::map<MobileEntity *, time_t> jumpOutTimes_;
116  std::set<MobileEntity *> recentlyJumpedOut_;
117 
119  };
120 
121 }
122 
123 #endif /* _Portals_H__ */
The BaseObject is the parent of all classes representing an instance in the game. ...
Definition: BaseObject.h:63
const std::string & getTemplate()
Get the name of the attached design template.
Definition: PortalEndPoint.h:88
Definition of the DistanceMultiTrigger class.
#define _PortalsExport
Definition: PortalsPrereqs.h:58
The StaticEntity is the simplest derivative of the orxonox::WorldEntity class.
Definition: StaticEntity.h:50
The WorldSound class is to be used for sounds with position and orientation.
Definition: WorldSound.h:44
::std::string string
Definition: gtest-port.h:756
unsigned int getReenterDelay()
Definition: PortalEndPoint.h:75
The DistanceMultiTrigger is a MultiTrigger that triggers whenever an object (that is of the specified...
Definition: DistanceMultiTrigger.h:90
Shared library macros, enums, constants and forward declarations for the questsystem module ...
Interface for receiving window events.
Definition: RadarViewable.h:48
static std::map< unsigned int, PortalEndPoint * > idMap_s
Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint.
Definition: PortalEndPoint.h:72
static const std::string EVENTFUNCTIONNAME
= "execute"
Definition: PortalEndPoint.h:108
xmlelement
Definition: Super.h:519
The MobileEntity is a derived class from orxonox::WorldEntity and orxonox::Tickable.
Definition: MobileEntity.h:53
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
A PortalEndPoint serves as portal entrance and/or exit.
Definition: PortalEndPoint.h:59
void setReenterDelay(unsigned int seconds)
Definition: PortalEndPoint.h:73
void setTemplate(const std::string &name)
Set templateName_ (the name of the design Template) and add that Template to this Object...
Definition: PortalEndPoint.h:84
Mode
Definition: CorePrereqs.h:102
std::map< MobileEntity *, time_t > jumpOutTimes_
Stores the time at which a certain MobileEntity jumped out of this PortalEndPoint.
Definition: PortalEndPoint.h:115
WorldSound * portalSound_
Definition: PortalEndPoint.h:118
void setTarget(const std::string &target)
Definition: PortalEndPoint.h:68
Definition: Context.h:45
std::string templateName_
The name of the design template used for this endpoint.
Definition: PortalEndPoint.h:112
std::set< MobileEntity * > recentlyJumpedOut_
Stores the entities witch recently jumped out of this PortalEndPoint and haven&#39;t left the activation ...
Definition: PortalEndPoint.h:116
unsigned int id_
the hopefully (depends on the writer of the levelfile) unique id, which is used to establish links be...
Definition: PortalEndPoint.h:110
int reenterDelay_
Definition: PortalEndPoint.h:114
Definition of the XMLPortEventState() macro, as well as some more useful macros.
DistanceMultiTrigger * trigger_
the DistanceMultiTrigger which notices near entities of the defined type
Definition: PortalEndPoint.h:111
unsigned int getID() const
Definition: PortalEndPoint.h:80
void setID(unsigned int id)
Definition: PortalEndPoint.h:77