Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/questsystem/src/orxonox/objects/AddReward.cc @ 1996

Last change on this file since 1996 was 1996, checked in by dafrick, 16 years ago

Some cleaning, reorganization and implementation of some small methods.

File size: 2.3 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#include "core/CoreIncludes.h"
30#include "AddReward.h"
31
32namespace orxonox {
33   
34    CreateFactory(AddReward);
35   
36    /**
37    @brief
38        Constructor. Creates a new AddReward effect with an input reward.
39    @param reward
40        A reward.
41    */
42    AddReward::AddReward(Rewardable & reward)
43    {
44        this->initialize();
45        this->addRewardable(reward);
46    }
47   
48    /**
49    @brief
50        Constructor. Creates a new AddReward effect with an input list of rewards.
51    @param rewards
52        A list of rewards.
53    */
54    AddReward::AddReward(std::list<Rewardable> & rewards)
55    {
56        this->initialize();
57        this->rewards_ = rewards;
58    }
59   
60    /**
61    @brief
62        Destructor.
63    */
64    AddReward::~AddReward()
65    {
66    }
67
68    /**
69    @brief
70        Initializes the object. Needs to be called first by every constructor of this class.
71    */
72    void AddReward::initialize(void)
73    {
74        RegisterObject(AddReward);
75    }
76
77    /**
78    @brief
79        Invokes the effect.
80    @param player
81        The player.
82    */
83    void AddReward::invoke(Player & player)
84    {
85        if ( this->rewards_ == NULL )
86        {
87            COUT(2) << "NULL-Rewards list encountered." << std::endl;
88            return;
89        }
90        for ( std::list<Rewardable>::iterator = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
91        {
92            reward.reward(player);
93        }
94    }
95
96}
Note: See TracBrowser for help on using the repository browser.