Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/pickup/PickupIdentifier.h @ 7456

Last change on this file since 7456 was 7456, checked in by dafrick, 14 years ago

Reviewing documentation fo Questsystem, moving documentation fully into doxygen.
Added some files to modules they belong to.

  • Property svn:eol-style set to native
File size: 3.4 KB
Line 
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
29/**
30    @file PickupIdentifier.h
31    @brief Definition of the PickupIdentifier class.
32    @ingroup Pickup
33*/
34
35#ifndef _PickupIdentifier_H__
36#define _PickupIdentifier_H__
37
38#include "OrxonoxPrereqs.h"
39
40#include <map>
41#include <string>
42#include "core/Identifier.h"
43
44#include "core/OrxonoxClass.h"
45
46namespace orxonox
47{
48
49    /**
50    @brief
51        The purpose of the PickupIdentifier class is to identify different types of pickups allthough they are of the same class.
52        This allows for more generic classes (or pickups in this case) that can be a number of different pickup types and can be identified as such without the need for a lot of different classes. An example is the HealthPickup class that encompasses a wide variety of different types of health pickups, e.g a HealthPickup that adds 10 health every second for 10 seconds or a HealthPickup that adds 100 health as soon as it is picked up, a.s.o.
53        To that purpose this class provides functionality to compare two PickupIdentifier (and since all Pickupables have an Identifier through that Pickupables can be compared). It als provides functionality to add parameters that distinguish between different types of pickups in the same pickup class.
54        Lastly a struct is provided that can be used in stl containers to establish a strictly lesser ordering between PickupIdentifiers (and thus Pickupables).
55    @author
56        Damian 'Mozork' Frick
57    */
58    class _OrxonoxExport PickupIdentifier : virtual public OrxonoxClass
59    {
60
61        public:
62            PickupIdentifier(Pickupable* pickup); //!< Constructor.
63            ~PickupIdentifier(); //!< Destructor.
64
65            virtual int compare(const PickupIdentifier* identifier) const; //!< Compares two PickupIdentifiers and returns 0 if a == b, <0 if a < b and >0 if a > b for a.compare(b).
66
67            bool addParameter(std::string & name, std::string & value); //!< Add a parameter to the PickupIdentifier.
68
69        private:
70            Pickupable* pickup_; //!< The Pickupable the PickupIdentififer is for.
71            std::map<std::string, std::string> parameters_; //!< The parameters identifying the type of the pickup beyond the class.
72
73    };
74
75    /**
76    @brief
77        Struct that overloads the compare operation between two PickupIdentifier pointers.
78    */
79    struct PickupIdentifierCompare
80    {
81        bool operator() (const PickupIdentifier* lhs, const PickupIdentifier* rhs) const
82            { return lhs->compare(rhs) < 0; }
83    };
84
85}
86
87#endif // _PickupIdentifier_H__
Note: See TracBrowser for help on using the repository browser.