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 | |
---|
37 | namespace orxonox |
---|
38 | { |
---|
39 | class _OrxonoxExport PlayerInfo : public Info |
---|
40 | { |
---|
41 | public: |
---|
42 | PlayerInfo(BaseObject* creator); |
---|
43 | virtual ~PlayerInfo(); |
---|
44 | |
---|
45 | virtual void changedName(); |
---|
46 | virtual void changedGametype(); |
---|
47 | |
---|
48 | virtual void changedController() {} |
---|
49 | virtual void changedControllableEntity() {} |
---|
50 | |
---|
51 | inline bool isHumanPlayer() const |
---|
52 | { return this->bHumanPlayer_; } |
---|
53 | inline bool isLocalPlayer() const |
---|
54 | { return this->bLocalPlayer_; } |
---|
55 | inline unsigned int getClientID() const |
---|
56 | { return this->clientID_; } |
---|
57 | |
---|
58 | virtual bool isInitialized() const = 0; |
---|
59 | virtual float getPing() const = 0; |
---|
60 | virtual float getPacketLossRatio() const = 0; |
---|
61 | |
---|
62 | inline void setReadyToSpawn(bool bReady) |
---|
63 | { this->bReadyToSpawn_ = bReady; } |
---|
64 | inline bool isReadyToSpawn() const |
---|
65 | { return this->bReadyToSpawn_; } |
---|
66 | |
---|
67 | void startControl(ControllableEntity* entity); |
---|
68 | void stopControl(); |
---|
69 | void startTemporaryControl(ControllableEntity* entity); |
---|
70 | void stopTemporaryControl(); |
---|
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 registerVariables(); |
---|
92 | void networkcallback_changedcontrollableentityID(); |
---|
93 | void networkcallback_changedgtinfoID(); |
---|
94 | void updateGametypeInfo(); |
---|
95 | |
---|
96 | bool bReadyToSpawn_; |
---|
97 | Controller* controller_; |
---|
98 | ControllableEntity* controllableEntity_; |
---|
99 | ControllableEntity* oldControllableEntity_; |
---|
100 | unsigned int controllableEntityID_; |
---|
101 | |
---|
102 | const GametypeInfo* gtinfo_; |
---|
103 | unsigned int gtinfoID_; |
---|
104 | }; |
---|
105 | } |
---|
106 | |
---|
107 | #endif /* _PlayerInfo_H__ */ |
---|