Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/infos/PlayerInfo.h @ 6122

Last change on this file since 6122 was 5929, checked in by rgrieder, 15 years ago

Merged core5 branch back to the trunk.
Key features include clean level unloading and an extended XML event system.

Two important notes:
Delete your keybindings.ini files! * or you will still get parser errors when loading the key bindings.
Delete build_dir/lib/modules/libgamestates.module! * or orxonox won't start.
Best thing to do is to delete the build folder ;)

  • Property svn:eol-style set to native
File size: 3.2 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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _PlayerInfo_H__
30#define _PlayerInfo_H__
31
32#include "OrxonoxPrereqs.h"
33
34#include "Info.h"
35#include "core/SubclassIdentifier.h"
36
37namespace orxonox
38{
39    class _OrxonoxExport PlayerInfo : public Info
40    {
41        public:
42            PlayerInfo(BaseObject* creator);
43            virtual ~PlayerInfo();
44
45            void registerVariables();
46
47            virtual void changedName();
48            virtual void changedGametype();
49
50            virtual void changedController() {}
51            virtual void changedControllableEntity() {}
52
53            inline bool isHumanPlayer() const
54                { return this->bHumanPlayer_; }
55            inline bool isLocalPlayer() const
56                { return this->bLocalPlayer_; }
57            inline unsigned int getClientID() const
58                { return this->clientID_; }
59
60            virtual bool isInitialized() const = 0;
61            virtual float getPing() const = 0;
62            virtual float getPacketLossRatio() const = 0;
63
64            inline void setReadyToSpawn(bool bReady)
65                { this->bReadyToSpawn_ = bReady; }
66            inline bool isReadyToSpawn() const
67                { return this->bReadyToSpawn_; }
68
69            void startControl(ControllableEntity* entity);
70            void stopControl();
71
72            inline ControllableEntity* getControllableEntity() const
73                { return this->controllableEntity_; }
74
75            inline Controller* getController() const
76                { return this->controller_; }
77
78            inline const GametypeInfo* getGametypeInfo() const
79                { return this->gtinfo_; }
80
81        protected:
82            void createController();
83
84            bool bHumanPlayer_;
85            bool bLocalPlayer_;
86            bool bSetUnreadyAfterSpawn_;
87            SubclassIdentifier<Controller> defaultController_;
88            unsigned int clientID_;
89
90        private:
91            void networkcallback_changedcontrollableentityID();
92            void networkcallback_changedgtinfoID();
93            void updateGametypeInfo();
94
95            bool bReadyToSpawn_;
96            Controller* controller_;
97            ControllableEntity* controllableEntity_;
98            unsigned int controllableEntityID_;
99
100            const GametypeInfo* gtinfo_;
101            unsigned int gtinfoID_;
102    };
103}
104
105#endif /* _PlayerInfo_H__ */
Note: See TracBrowser for help on using the repository browser.