Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core3/src/orxonox/objects/Projectile.h @ 1683

Last change on this file since 1683 was 1683, checked in by landauf, 16 years ago

removed some outcommented lines (I did this in a separate commit because we might want to revert some of them)

  • Property svn:eol-style set to native
File size: 3.7 KB
RevLine 
[1505]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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _Projectile_H__
30#define _Projectile_H__
31
32#include "OrxonoxPrereqs.h"
33
34#include "WorldEntity.h"
[1552]35#include "tools/Timer.h"
[1676]36#undef SUPER_INTRUSIVE
37#include "core/Super.h"
[1505]38
39namespace orxonox
40{
41    class _OrxonoxExport Projectile : public WorldEntity
42    {
43        public:
44            virtual ~Projectile();
45            void setConfigValues();
[1596]46            void speedChanged();
[1505]47            void destroyObject();
48            virtual void tick(float dt);
[1676]49            virtual void testfunction();
[1505]50
51            static float getSpeed()
[1596]52                { return Projectile::speed_s; }
[1505]53
54        protected:
[1552]55            Projectile(SpaceShip* owner = 0);
[1505]56            SpaceShip* owner_;
57
58        private:
[1552]59            std::string explosionTemplateName_;
60            std::string smokeTemplateName_;
[1596]61        protected:
62            static float speed_s;
63            float speed_;
64        private:
[1505]65            float lifetime_;
[1552]66            float damage_;
[1505]67            Timer<Projectile> destroyTimer_;
68    };
[1676]69
70    // Partially specialized template (templatehack is now specialized too)
71    template <class T>
72    struct SuperFunctionCondition<0, 0, T>
73    {
74        // Checks if class U isA baseclass and sets the functionpointer if the check returned true
75        static void check()
76        {
77            std::cout << "check superfunction \"testfunction\" in " << ClassIdentifier<T>::getIdentifier()->getName() << std::endl;
78
[1681]79            T* temp = 0;
[1676]80            SuperFunctionCondition<0, 0, T>::apply(temp);
81
82            std::cout << "done" << std::endl;
83
84            // Calls the condition of the next super-function
85            SuperFunctionCondition<0 + 1, 0, T>::check();
86        }
87
88        static void apply(void* temp)
89        {
90            std::cout << ClassIdentifier<T>::getIdentifier()->getName() << " is not a Projectile" << std::endl;
91            // nop
92        }
93
94        static void apply(Projectile* temp)
95        {
96            std::cout << ClassIdentifier<T>::getIdentifier()->getName() << " is a Projectile" << std::endl;
97            ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
98
99            // Iterate through all children and assign the caller
100            for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it)
101            {
102                if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_)
103                {
104                    std::cout << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << std::endl;
[1682]105                    ((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_ = new SuperFunctionClassCaller_testfunction<T>;
[1676]106                }
107            }
108        }
109    };
[1505]110}
111
112#endif /* _Projectile_H__ */
Note: See TracBrowser for help on using the repository browser.