Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/pickup/CollectiblePickup.cc @ 10904

Last change on this file since 10904 was 10624, checked in by landauf, 9 years ago

merged branch core7 back to trunk

  • Property svn:eol-style set to native
File size: 2.8 KB
RevLine 
[7162]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 CollectiblePickup.cc
31    @brief Implementation of the CollectiblePickup class.
32*/
33
34#include "CollectiblePickup.h"
35
36#include "core/CoreIncludes.h"
[7494]37
[7162]38#include "PickupCollection.h"
39
[9667]40namespace orxonox
41{
[10624]42    RegisterAbstractClass(CollectiblePickup).inheritsFrom<Pickupable>();
[7162]43
44    /**
45    @brief
46        Constructor.
47        Registers the object and initializes variables.
48    */
[9348]49    CollectiblePickup::CollectiblePickup() : collection_(NULL)
[7162]50    {
51        RegisterObject(CollectiblePickup);
52    }
53
54    /**
55    @brief
56        Destructor.
57    */
58    CollectiblePickup::~CollectiblePickup()
59    {
[9348]60        if (this->isInCollection())
61            this->collection_->removePickupable(this);
[7162]62    }
63
64    /**
65    @brief
66        Is called when the pickup has transited from used to unused or the other way around.
67    */
68    void CollectiblePickup::changedUsed(void)
69    {
70        SUPER(CollectiblePickup, changedUsed);
71
72        if(this->isInCollection())
73            this->collection_->pickupChangedUsed(this->isUsed());
74    }
75
76    /**
77    @brief
78        Is called when the pickup has transited from picked up to dropped or the other way around.
79    */
80    void CollectiblePickup::changedPickedUp(void)
81    {
82        SUPER(CollectiblePickup, changedPickedUp);
83
84        if(this->isInCollection())
85            this->collection_->pickupChangedPickedUp(this->isPickedUp());
86    }
87
88    /**
89    @brief
[9348]90        Notifies this CollectiblePickup that it was added to a PickupCollection.
[7162]91    @param collection
92        A pointer to the PickupCollection to which the CollectiblePickup should be added.
93    */
[9348]94    void CollectiblePickup::wasAddedToCollection(PickupCollection* collection)
[7162]95    {
96        this->collection_ = collection;
97    }
98
99    /**
100    @brief
[9348]101        Notifies this CollectiblePickup that it was removed from its PickupCollection.
[7162]102    */
[9348]103    void CollectiblePickup::wasRemovedFromCollection(void)
[7162]104    {
105        this->collection_ = NULL;
106    }
107}
Note: See TracBrowser for help on using the repository browser.