Orxonox  0.0.5 Codename: Arcturus
PickupCarrier.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  * Damian 'Mozork' Frick
24  * Co-authors:
25  * ...
26  *
27  */
28 
35 #ifndef _PickupCarrier_H__
36 #define _PickupCarrier_H__
37 
38 #include "OrxonoxPrereqs.h"
39 
40 #include <set>
41 #include <vector>
42 
44 
45 namespace orxonox
46 {
47 
48  // Forward-declarations.
49  class MetaPickup;
50 
69  {
70  // So that the different Pickupables have full access to their PickupCarrier.
71  friend class Pickupable;
72  friend class PickupManager;
73  // Friends.
74  friend class MetaPickup;
75 
76  public:
77  PickupCarrier();
78  virtual ~PickupCarrier();
79  virtual void preDestroy(void) override;
80 
81  bool isTarget(const Pickupable* pickup) const;
82  PickupCarrier* getTarget(const Pickupable* pickup);
83 
89  virtual const Vector3& getCarrierPosition(void) const = 0;
90 
91  protected:
98  virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const = 0;
104  virtual PickupCarrier* getCarrierParent(void) const = 0;
105 
110  std::set<Pickupable*>& getPickups(void)
111  { return this->pickups_; }
112 
113  private:
114  std::set<Pickupable*> pickups_;
115 
116  bool addPickup(Pickupable* pickup);
117  bool removePickup(Pickupable* pickup);
118 
119  };
120 }
121 
122 #endif /* _PickupCarrier_H__ */
An Interface (or more precisely an abstract class) to model and represent different (all kinds of) pi...
Definition: Pickupable.h:60
This is the class from which all interfaces of the game-logic (not the engine) are derived from...
Definition: OrxonoxInterface.h:50
The MetaPickup is a Pickupable that can, depending on the parameter metaTye, do different things...
Definition: MetaPickup.h:84
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Declaration of OrxonoxInterface, the base class of all interfaces in Orxonox.
std::set< Pickupable * > pickups_
The list of Pickupables carried by this PickupCarrier.
Definition: PickupCarrier.h:114
Shared library macros, enums, constants and forward declarations for the orxonox library ...
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
std::set< Pickupable * > & getPickups(void)
Get all Pickupables this PickupCarrier has.
Definition: PickupCarrier.h:110
The PickupCarrier interface provides the means, for any class implementing it, to possess Pickupables...
Definition: PickupCarrier.h:68
The PickupManager class manages Pickupables.
Definition: PickupManager.h:99