Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/interfaces/PickupListener.cc @ 11071

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

merged branch cpp11_v3 back to trunk

  • Property svn:eol-style set to native
File size: 2.8 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 PickupListener.cc
31    @brief Implementation of the PickupListener class.
32*/
33
34#include "OrxonoxPrereqs.h"
35
36#include "core/CoreIncludes.h"
37
38#include "PickupListener.h"
39
40namespace orxonox
41{
42    RegisterAbstractClass(PickupListener).inheritsFrom<OrxonoxInterface>();
43
44    /**
45    @brief
46        Constructor. Registers the object.
47    */
48    PickupListener::PickupListener()
49    {
50        RegisterObject(PickupListener);
51    }
52
53    /**
54    @brief
55        Destructor.
56    */
57    PickupListener::~PickupListener()
58    {
59
60    }
61
62    /**
63    @brief
64        Static method that is used to notify the PickupListener itself of the change in the used status of a Pickupable.
65        This is called in Pickupable.
66    @param pickup
67        The Pickupable that has changed its used status.
68    @param used
69        Thse value the status has changed to.
70    */
71    /*static*/ void PickupListener::broadcastPickupChangedUsed(Pickupable* pickup, bool used)
72    {
73        assert(pickup);
74
75        // Iterate through all PickupListeners and notify them by calling the method they overloaded.
76        for(PickupListener* listener : ObjectList<PickupListener>())
77            listener->pickupChangedUsed(pickup, used);
78    }
79
80    /**
81    @brief
82        Static method that is used to notify the PickupListener itself of the change in the pickedUp status of a Pickupable.
83        This is called in Pickupable.
84    @param pickup
85        The Pickupable that has changed its pickedUp status.
86    @param pickedUp
87        Thse value the status has changed to.
88    */
89    /*static*/ void PickupListener::broadcastPickupChangedPickedUp(Pickupable* pickup, bool pickedUp)
90    {
91        assert(pickup);
92
93        // Iterate through all PickupListeners and notify them by calling the method they overloaded.
94        for(PickupListener* listener : ObjectList<PickupListener>())
95            listener->pickupChangedPickedUp(pickup, pickedUp);
96    }
97
98}
Note: See TracBrowser for help on using the repository browser.