Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation3/src/orxonox/interfaces/InterfaceCompilation.cc @ 7162

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

Significant structural changes to the pickup module. Lots of bugs found and fixed.
Introduced a new class CollectiblePickup (which is now the only kind a PickupCollection can consist of) to solve some issues cleanly.
MetaPickup received additional functionality. It can now also be set to either destroy all the pickups of a PickupCarrier or destroy the PickupCarrier itself. (This was done mainly for testing purposes)
I've done some extensive testing on the pickups, so they should really work now.

  • 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 *      Reto Grieder
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30@file
31@brief
32    Compiles all the interfaces in the orxonox library with mostly just a constructor.
33*/
34
35#include "GametypeMessageListener.h"
36#include "PickupCarrier.h"
37#include "PlayerTrigger.h"
38#include "RadarListener.h"
39#include "Rewardable.h"
40#include "TeamColourable.h"
41#include "NotificationListener.h"
42
43#include "core/CoreIncludes.h"
44
45namespace orxonox
46{
47    //----------------------------
48    // GametypeMessageListener
49    //----------------------------
50    GametypeMessageListener::GametypeMessageListener()
51    {
52        RegisterRootObject(GametypeMessageListener);
53    }
54
55    //----------------------------
56    // PickupCarrier
57    //----------------------------
58    PickupCarrier::PickupCarrier()
59    {
60        RegisterRootObject(PickupCarrier);
61    }
62
63    PickupCarrier::~PickupCarrier()
64    {
65
66    }
67
68    void PickupCarrier::preDestroy(void)
69    {
70        std::set<Pickupable*>::iterator it = this->pickups_.begin();
71        std::set<Pickupable*>::iterator temp;
72        while(it != this->pickups_.end())
73        {
74            (*it)->carrierDestroyed();
75            temp = it;
76            it = this->pickups_.begin();
77            if(it == temp) // Infinite loop avoidance, in case the pickup wasn't removed from the carrier somewhere in the carrierDestroy() procedure.
78            {
79                COUT(2) << "Oops. In a PickupCarrier, while cleaning up, a Pickupable (&" << (*temp) << ") didn't unregister itself as it should have." << std::endl;;
80                it++;
81            }
82        }
83
84        this->pickups_.clear();
85    }
86
87    //----------------------------
88    // PlayerTrigger
89    //----------------------------
90    PlayerTrigger::PlayerTrigger()
91    {
92        RegisterRootObject(PlayerTrigger);
93
94        this->player_ = NULL;
95        this->isForPlayer_ = true;
96    }
97
98    //----------------------------
99    // RadarListener
100    //----------------------------
101    RadarListener::RadarListener()
102    {
103        RegisterRootObject(RadarListener);
104    }
105
106    //----------------------------
107    // TeamColourable
108    //----------------------------
109    TeamColourable::TeamColourable()
110    {
111        RegisterRootObject(TeamColourable);
112    }
113
114    //----------------------------
115    // Rewardable
116    //----------------------------
117    Rewardable::Rewardable()
118    {
119        RegisterRootObject(Rewardable);
120    }
121
122    //----------------------------
123    // NotificationListener
124    //----------------------------
125    NotificationListener::NotificationListener()
126    {
127        RegisterRootObject(NotificationListener);
128    }
129}
Note: See TracBrowser for help on using the repository browser.