[2072] | 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" |
---|
[5929] | 35 | #include "core/SubclassIdentifier.h" |
---|
[2072] | 36 | |
---|
| 37 | namespace 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 | |
---|
[2826] | 50 | virtual void changedController() {} |
---|
| 51 | virtual void changedControllableEntity() {} |
---|
| 52 | |
---|
[2072] | 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 | |
---|
[2171] | 60 | virtual bool isInitialized() const = 0; |
---|
[2072] | 61 | virtual float getPing() const = 0; |
---|
| 62 | virtual float getPacketLossRatio() const = 0; |
---|
| 63 | |
---|
| 64 | inline void setReadyToSpawn(bool bReady) |
---|
| 65 | { this->bReadyToSpawn_ = bReady; } |
---|
[2171] | 66 | inline bool isReadyToSpawn() const |
---|
| 67 | { return this->bReadyToSpawn_; } |
---|
[2072] | 68 | |
---|
[3038] | 69 | void startControl(ControllableEntity* entity); |
---|
| 70 | void stopControl(); |
---|
[6082] | 71 | void startTemporaryControl(ControllableEntity* entity); |
---|
| 72 | void stopTemporaryControl(); |
---|
[2072] | 73 | |
---|
| 74 | inline ControllableEntity* getControllableEntity() const |
---|
| 75 | { return this->controllableEntity_; } |
---|
| 76 | |
---|
[2662] | 77 | inline Controller* getController() const |
---|
| 78 | { return this->controller_; } |
---|
| 79 | |
---|
[2973] | 80 | inline const GametypeInfo* getGametypeInfo() const |
---|
| 81 | { return this->gtinfo_; } |
---|
| 82 | |
---|
[2072] | 83 | protected: |
---|
| 84 | void createController(); |
---|
| 85 | |
---|
| 86 | bool bHumanPlayer_; |
---|
| 87 | bool bLocalPlayer_; |
---|
[2662] | 88 | bool bSetUnreadyAfterSpawn_; |
---|
| 89 | SubclassIdentifier<Controller> defaultController_; |
---|
| 90 | unsigned int clientID_; |
---|
| 91 | |
---|
| 92 | private: |
---|
| 93 | void networkcallback_changedcontrollableentityID(); |
---|
[2973] | 94 | void networkcallback_changedgtinfoID(); |
---|
| 95 | void updateGametypeInfo(); |
---|
[2662] | 96 | |
---|
[2072] | 97 | bool bReadyToSpawn_; |
---|
| 98 | Controller* controller_; |
---|
| 99 | ControllableEntity* controllableEntity_; |
---|
[6101] | 100 | ControllableEntity* oldControllableEntity_; |
---|
[2072] | 101 | unsigned int controllableEntityID_; |
---|
[2973] | 102 | |
---|
| 103 | const GametypeInfo* gtinfo_; |
---|
| 104 | unsigned int gtinfoID_; |
---|
[2072] | 105 | }; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | #endif /* _PlayerInfo_H__ */ |
---|