3
*************************************************************************
5
ArmageTron -- Just another Tron Lightcycle Game in 3D.
6
Copyright (C) 2000 Manuel Moos (manuel@moosnet.de)
8
**************************************************************************
10
This program is free software; you can redistribute it and/or
11
modify it under the terms of the GNU General Public License
12
as published by the Free Software Foundation; either version 2
13
of the License, or (at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
***************************************************************************
28
#ifndef ArmageTron_PLAYER_H
29
#define ArmageTron_PLAYER_H
31
#ifndef MAX_INSTANT_CHAT
32
#define MAX_INSTANT_CHAT 25
43
#include "eNetGameObject.h"
44
#include "tCallbackString.h"
45
#include "nSpamProtection.h"
53
#define PLAYER_CONFITEMS (30+MAX_INSTANT_CHAT)
55
// maximal length of chat message
56
extern int se_SpamMaxLen;
58
// Maximum number of chat entries to save for spam analysis
59
extern int se_lastSaidMaxEntries;
61
// time during which no repeaded chat messages are printed
62
extern REAL se_alreadySaidTimeout;
64
// minimal access level for chat
65
extern tAccessLevel se_chatAccessLevel;
67
// time between public chat requests, set to 0 to disable
68
extern REAL se_chatRequestTimeout;
70
// call on commands that only work on the server; quit if it returns true
71
bool se_NeedsServer(char const * command, std::istream & s, bool strict = true );
79
class ePlayer: public uPlayerPrototype{
80
friend class eMenuItemChat;
81
static uActionPlayer s_chat;
82
static uActionTooltip s_chatTooltip;
84
tConfItemBase *configuration[PLAYER_CONFITEMS];
86
void StoreConfitem(tConfItemBase *c);
87
void DeleteConfitems();
91
tString name; // the player's screen name
92
tString globalID; // the global ID of the player in user@authority form
3
*************************************************************************
5
ArmageTron -- Just another Tron Lightcycle Game in 3D.
6
Copyright (C) 2000 Manuel Moos (manuel@moosnet.de)
8
**************************************************************************
10
This program is free software; you can redistribute it and/or
11
modify it under the terms of the GNU General Public License
12
as published by the Free Software Foundation; either version 2
13
of the License, or (at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
***************************************************************************
28
#ifndef ArmageTron_PLAYER_H
29
#define ArmageTron_PLAYER_H
31
#ifndef MAX_INSTANT_CHAT
32
#define MAX_INSTANT_CHAT 25
43
#include "eNetGameObject.h"
44
#include "tCallbackString.h"
45
#include "nSpamProtection.h"
53
#define PLAYER_CONFITEMS (30+MAX_INSTANT_CHAT)
55
// maximal length of chat message
56
extern int se_SpamMaxLen;
58
// Maximum number of chat entries to save for spam analysis
59
extern int se_lastSaidMaxEntries;
61
// time during which no repeaded chat messages are printed
62
extern REAL se_alreadySaidTimeout;
64
// minimal access level for chat
65
extern tAccessLevel se_chatAccessLevel;
67
// time between public chat requests, set to 0 to disable
68
extern REAL se_chatRequestTimeout;
70
// call on commands that only work on the server; quit if it returns true
71
bool se_NeedsServer(char const * command, std::istream & s, bool strict = true );
79
class ePlayer: public uPlayerPrototype{
80
friend class eMenuItemChat;
81
static uActionPlayer s_chat;
82
static uActionTooltip s_chatTooltip;
84
tConfItemBase *configuration[PLAYER_CONFITEMS];
86
void StoreConfitem(tConfItemBase *c);
87
void DeleteConfitems();
91
tString name; // the player's screen name
92
tString globalID; // the global ID of the player in user@authority form
93
93
// REAL rubberstatus;
95
bool centerIncamOnTurn;
99
bool spectate; // shall this player always spectate?
100
bool stealth; // does this player wish to hide his/her identity?
101
bool autoLogin; // should the player always request authentication on servers?
103
bool nameTeamAfterMe; // player prefers to call his team after his name
104
int favoriteNumberOfPlayersPerTeam;
106
eCamMode startCamera;
109
bool smartCustomGlance; //!< flag making the smart camera use the custom settings for glancing
111
tCHECKED_PTR(eCamera) cam;
112
tCONTROLLED_PTR(ePlayerNetID) netPlayer;
114
int rgb[3]; // our color
116
tString instantChatString[MAX_INSTANT_CHAT];
117
// instant chat macros
119
static uActionPlayer *se_instantChatAction[MAX_INSTANT_CHAT];
95
bool centerIncamOnTurn;
99
bool spectate; // shall this player always spectate?
100
bool stealth; // does this player wish to hide his/her identity?
101
bool autoLogin; // should the player always request authentication on servers?
103
bool nameTeamAfterMe; // player prefers to call his team after his name
104
int favoriteNumberOfPlayersPerTeam;
106
eCamMode startCamera;
109
bool smartCustomGlance; //!< flag making the smart camera use the custom settings for glancing
111
tCHECKED_PTR(eCamera) cam;
112
tCONTROLLED_PTR(ePlayerNetID) netPlayer;
114
int rgb[3]; // our color
116
tString instantChatString[MAX_INSTANT_CHAT];
117
// instant chat macros
119
static uActionPlayer *se_instantChatAction[MAX_INSTANT_CHAT];
124
124
virtual const char *Name() const{return name;}
125
virtual const char *Teamname() const{return teamname;}
127
virtual bool Act(uAction *act,REAL x);
129
int ID() const {return id;}
134
static ePlayer * PlayerConfig(int p);
136
static bool PlayerIsInGame(int p);
138
// veto function for tooltips that require a controllable game object
139
static bool VetoActiveTooltip(int player);
141
static rViewport * PlayerViewport(int p);
143
static void LogIn(); //!< sends authentication login messages for all local players
144
static void SendAuthNames(); //!< sends authentication names and authentication wishes for all local players
150
//! class managing access levels.
151
class eAccessLevelHolder
154
eAccessLevelHolder();
156
tAccessLevel GetAccessLevel() const { return accessLevel; }
157
void SetAccessLevel( tAccessLevel level );
160
tAccessLevel accessLevel; //!< admin access level of the current user
163
//! detector for turn timing assist bots
164
class eUncannyTimingDetector
167
//! settings for a single analyzer
168
struct eUncannyTimingSettings
170
REAL timescale; //!< the timescale. Events are divided in two buckets, one between 0 and timescale/2, the other from timescale/2 to timescale.
171
REAL maxGoodRatio; //!< the maximal allowed recent ratio of events to land in the 'good' bucket
172
REAL goodHumanRatio; //!< the maximal observed ratio for a human
173
int averageOverEvents; //!< number of events to average over
175
mutable REAL bestRatio; //!< best ratio achieved by players during this session
177
eUncannyTimingSettings( REAL ts, REAL human, REAL max )
178
: timescale( ts ), maxGoodRatio( max ), goodHumanRatio(human), averageOverEvents(40)
182
~eUncannyTimingSettings();
185
//! single analyzer with single timescale
186
class eUncannyTimingAnalysis
189
//! analyze a single timing event
190
REAL Analyze( REAL timing, eUncannyTimingSettings const & settings );
191
eUncannyTimingAnalysis();
193
REAL accurateRatio; //!< ratio of events in the more accurate half
194
int turnsSoFar; //!< number of turns accounted for so far
197
//! detection level of timing aid hacks
200
DangerLevel_Low, //!< about 25% of the tolerance reached
201
DangerLevel_Medium, //!< about 50% of the tolerance reached
202
DangerLevel_High, //!< about 75% of the tolerance reached
203
DangerLevel_Max //!< 100% of the tolerance reached, worst action triggered
206
eUncannyTimingDetector();
208
//! analzye a timing event
209
void Analyze( REAL timing, ePlayerNetID * player );
211
//! three analyzers for varying timescales
212
eUncannyTimingAnalysis fast, medium, slow;
214
DangerLevel dangerLevel;
217
// the class that identifies players across the network
218
class ePlayerNetID: public nNetObject, public eAccessLevelHolder{
219
friend class ePlayer;
221
friend class eNetGameObject;
222
friend class tControlledPTR< ePlayerNetID >;
223
// access level. lower numeric values are better.
225
typedef std::set< eTeam * > eTeamSet;
228
int listID; // ID in the list of all players
229
int teamListID; // ID in the list of the team
125
virtual const char *Teamname() const{return teamname;}
127
virtual bool Act(uAction *act,REAL x);
129
int ID() const {return id;}
134
static ePlayer * PlayerConfig(int p);
136
static bool PlayerIsInGame(int p);
138
// veto function for tooltips that require a controllable game object
139
static bool VetoActiveTooltip(int player);
141
static rViewport * PlayerViewport(int p);
143
static void LogIn(); //!< sends authentication login messages for all local players
144
static void SendAuthNames(); //!< sends authentication names and authentication wishes for all local players
150
//! class managing access levels.
151
class eAccessLevelHolder
154
eAccessLevelHolder();
156
tAccessLevel GetAccessLevel() const { return accessLevel; }
157
void SetAccessLevel( tAccessLevel level );
160
tAccessLevel accessLevel; //!< admin access level of the current user
163
//! detector for turn timing assist bots
164
class eUncannyTimingDetector
167
//! settings for a single analyzer
168
struct eUncannyTimingSettings
170
REAL timescale; //!< the timescale. Events are divided in two buckets, one between 0 and timescale/2, the other from timescale/2 to timescale.
171
REAL maxGoodRatio; //!< the maximal allowed recent ratio of events to land in the 'good' bucket
172
REAL goodHumanRatio; //!< the maximal observed ratio for a human
173
int averageOverEvents; //!< number of events to average over
175
mutable REAL bestRatio; //!< best ratio achieved by players during this session
177
eUncannyTimingSettings( REAL ts, REAL human, REAL max )
178
: timescale( ts ), maxGoodRatio( max ), goodHumanRatio(human), averageOverEvents(40)
182
~eUncannyTimingSettings();
185
//! single analyzer with single timescale
186
class eUncannyTimingAnalysis
189
//! analyze a single timing event
190
REAL Analyze( REAL timing, eUncannyTimingSettings const & settings );
191
eUncannyTimingAnalysis();
193
REAL accurateRatio; //!< ratio of events in the more accurate half
194
int turnsSoFar; //!< number of turns accounted for so far
197
//! detection level of timing aid hacks
200
DangerLevel_Low, //!< about 25% of the tolerance reached
201
DangerLevel_Medium, //!< about 50% of the tolerance reached
202
DangerLevel_High, //!< about 75% of the tolerance reached
203
DangerLevel_Max //!< 100% of the tolerance reached, worst action triggered
206
eUncannyTimingDetector();
208
//! analzye a timing event
209
void Analyze( REAL timing, ePlayerNetID * player );
211
//! three analyzers for varying timescales
212
eUncannyTimingAnalysis fast, medium, slow;
214
DangerLevel dangerLevel;
217
// the class that identifies players across the network
218
class ePlayerNetID: public nNetObject, public eAccessLevelHolder{
219
friend class ePlayer;
221
friend class eNetGameObject;
222
friend class tControlledPTR< ePlayerNetID >;
223
// access level. lower numeric values are better.
225
typedef std::set< eTeam * > eTeamSet;
228
int listID; // ID in the list of all players
229
int teamListID; // ID in the list of the team
231
231
bool silenced_; // flag indicating whether the player has been silenced
233
233
int roundsSuspended_; // number of rounds the player is currently suspended from playing
234
234
bool suspended_; // flag indicating whether the player has been suspended
235
tString suspendReason_; // what was the reason for suspending this person...?
237
nTimeAbsolute timeCreated_; // the time the player was created
238
nTimeAbsolute timeJoinedTeam; // the time the player joined the team he is in now
239
tCONTROLLED_PTR(eTeam) nextTeam; // the team we're in ( logically )
240
tCONTROLLED_PTR(eTeam) currentTeam; // the team we currently are spawned for
241
eTeamSet invitations_; // teams this player is invited to
243
tCHECKED_PTR(eNetGameObject) object; // the object this player is
246
int score; // points made so far
247
int lastScore_; // last saved score
249
int favoriteNumberOfPlayersPerTeam; // join team if number of players on it is less than this; create new team otherwise
250
bool nameTeamAfterMe; // player prefers to call his team after his name
251
bool greeted; // did the server already greet him?
252
bool disconnected; // did he disconnect from the game?
254
static void SwapPlayersNo(int a,int b); // swaps the players a and b
256
ePlayerNetID& operator= (const ePlayerNetID&); // forbid copy constructor
258
bool spectating_; //!< are we currently spectating? Spectators don't get assigned to teams.
259
bool stealth_; //!< does this player want to hide his/her identity?
260
bool chatting_; //!< are we currently chatting?
261
int chatFlags_; //!< different types of reasons for beeing chatting
262
bool allowTeamChange_; //!< allow team changes even if ALLOW_TEAM_CHANGE is disabled?
264
//For improved remoteadmin
265
tAccessLevel lastAccessLevel;//!< access level at the time of the last name update
267
eUncannyTimingDetector uncannyTimingDetector_; //!< detector for timingbots
269
nMachine * registeredMachine_; //!< the machine the player is registered with
270
void RegisterWithMachine(); //!< registers with a machine
271
void UnregisterWithMachine(); //!< un registers with a machine
273
tJUST_CONTROLLED_PTR< ePlayerNetID > substitute; // the player who will replace this one next round
276
bool SetSubstitute(ePlayerNetID *p); //!< set substitute for this player
277
bool ApplySubstitution(); //!< perform substitution ie remove this player from the game and replace him by his substitute at the same position
278
static void ClearSubstitutes(); //!< remove all substitutes
279
static void ApplySubstitutions(); //!< perform substitutions for all players
286
ChatFlags_Console = 8
289
bool flagOverrideChat;
235
tString suspendReason_; // what was the reason for suspending this person...?
237
nTimeAbsolute timeCreated_; // the time the player was created
238
nTimeAbsolute timeJoinedTeam; // the time the player joined the team he is in now
239
tCONTROLLED_PTR(eTeam) nextTeam; // the team we're in ( logically )
240
tCONTROLLED_PTR(eTeam) currentTeam; // the team we currently are spawned for
241
eTeamSet invitations_; // teams this player is invited to
243
tCHECKED_PTR(eNetGameObject) object; // the object this player is
246
int score; // points made so far
247
int lastScore_; // last saved score
249
int favoriteNumberOfPlayersPerTeam; // join team if number of players on it is less than this; create new team otherwise
250
bool nameTeamAfterMe; // player prefers to call his team after his name
251
bool greeted; // did the server already greet him?
252
bool disconnected; // did he disconnect from the game?
254
static void SwapPlayersNo(int a,int b); // swaps the players a and b
256
ePlayerNetID& operator= (const ePlayerNetID&); // forbid copy constructor
258
bool spectating_; //!< are we currently spectating? Spectators don't get assigned to teams.
259
bool stealth_; //!< does this player want to hide his/her identity?
260
bool chatting_; //!< are we currently chatting?
261
int chatFlags_; //!< different types of reasons for beeing chatting
262
bool allowTeamChange_; //!< allow team changes even if ALLOW_TEAM_CHANGE is disabled?
264
//For improved remoteadmin
265
tAccessLevel lastAccessLevel;//!< access level at the time of the last name update
267
eUncannyTimingDetector uncannyTimingDetector_; //!< detector for timingbots
269
nMachine * registeredMachine_; //!< the machine the player is registered with
270
void RegisterWithMachine(); //!< registers with a machine
271
void UnregisterWithMachine(); //!< un registers with a machine
273
tJUST_CONTROLLED_PTR< ePlayerNetID > substitute; // the player who will replace this one next round
276
bool SetSubstitute(ePlayerNetID *p); //!< set substitute for this player
277
bool ApplySubstitution(); //!< perform substitution ie remove this player from the game and replace him by his substitute at the same position
278
static void ClearSubstitutes(); //!< remove all substitutes
279
static void ApplySubstitutions(); //!< perform substitutions for all players
286
ChatFlags_Console = 8
289
bool flagOverrideChat;
293
293
// REAL rubberstatus;
295
tArray<tString> lastSaid;
296
tArray<nTimeRolling> lastSaidTimes;
297
// void SetLastSaid(tString ls);
298
unsigned short r,g,b; // our color
300
unsigned short pingCharity; // max ping you are willing to take over
304
double lastSync; //!< time of the last sync request
305
double lastActivity_; //!< time of the last activity
307
bool loginWanted; //!< flag indicating whether this player currently wants to log on
309
bool renameAllowed_; //!< specifies if the player is allowed to rename or not, does not know about votes.
311
nSpamProtection & GetChatSpam(); //!< chat volume spam
312
eChatLastSaid & GetLastSaid(); //!< last said information
313
eShuffleSpamTester & GetShuffleSpam(); //!< shuffle message spam
315
ePlayerNetID(int p=-1);
316
ePlayerNetID(nMessage &m);
317
virtual ~ePlayerNetID();
319
virtual bool ActionOnQuit();
320
virtual void ActionOnDelete();
323
bool IsChatting() const { return chatting_; }
324
void SetChatting ( ChatFlags flag, bool chatting );
327
bool IsSpectating() const { return spectating_; }
329
bool StealthMode() const { return stealth_; }
332
bool TeamChangeAllowed( bool informPlayer = false ) const; //!< is this player allowed to change teams?
333
void SetTeamChangeAllowed(bool allowed) {allowTeamChange_ = allowed;} //!< set if this player should always be allowed to change teams
334
eTeam *NextTeam() const { return nextTeam; } // return the team I will be next round
335
eTeam *CurrentTeam() const { return currentTeam; } // return the team I am in
336
int TeamListID() const { return teamListID; } // return my position in the team
337
int ListID() const { return listID; } // return my position in the player's list
338
void SetShuffleWish( int pos ); //!< sets a desired team position
295
tArray<tString> lastSaid;
296
tArray<nTimeRolling> lastSaidTimes;
297
// void SetLastSaid(tString ls);
298
unsigned short r,g,b; // our color
300
unsigned short pingCharity; // max ping you are willing to take over
304
double lastSync; //!< time of the last sync request
305
double lastActivity_; //!< time of the last activity
307
bool loginWanted; //!< flag indicating whether this player currently wants to log on
309
bool renameAllowed_; //!< specifies if the player is allowed to rename or not, does not know about votes.
311
nSpamProtection & GetChatSpam(); //!< chat volume spam
312
eChatLastSaid & GetLastSaid(); //!< last said information
313
eShuffleSpamTester & GetShuffleSpam(); //!< shuffle message spam
315
ePlayerNetID(int p=-1);
316
ePlayerNetID(nMessage &m);
317
virtual ~ePlayerNetID();
319
virtual bool ActionOnQuit();
320
virtual void ActionOnDelete();
323
bool IsChatting() const { return chatting_; }
324
void SetChatting ( ChatFlags flag, bool chatting );
327
bool IsSpectating() const { return spectating_; }
329
bool StealthMode() const { return stealth_; }
332
bool TeamChangeAllowed( bool informPlayer = false ) const; //!< is this player allowed to change teams?
333
void SetTeamChangeAllowed(bool allowed) {allowTeamChange_ = allowed;} //!< set if this player should always be allowed to change teams
334
eTeam *NextTeam() const { return nextTeam; } // return the team I will be next round
335
eTeam *CurrentTeam() const { return currentTeam; } // return the team I am in
336
int TeamListID() const { return teamListID; } // return my position in the team
337
int ListID() const { return listID; } // return my position in the player's list
338
void SetShuffleWish( int pos ); //!< sets a desired team position
340
340
eTeam * FindDefaultTeam(); // find a good default team for us
341
341
void SetDefaultTeam(); // register me in a good default team
342
342
void SetTeamForce(eTeam* team ); // register me in the given team without checks
343
void SetTeam(eTeam* team); // register me in the given team (callable on the server)
343
void SetTeam(eTeam* team); // register me in the given team (callable on the server)
344
344
void SetTeamWish(eTeam* team); // express the wish to be part of the given team (always callable)
345
void SetTeamname(const char *); // set teamname to be used for my own team
346
void UpdateTeamForce(); // update team membership without checks
347
void UpdateTeam(); // update team membership
349
eTeamSet const & GetInvitations() const ; //!< teams this player is invited to
351
void CreateNewTeam(); // create a new team and join it (on the server)
352
void CreateNewTeamWish(); // express the wish to create a new team and join it
353
virtual void ReceiveControlNet(nMessage &m);// receive the team control wish
355
static bool Enemies( ePlayerNetID const * a, ePlayerNetID const * b ); //!< determines whether two players are opponents and can score points against each other
357
// print out an understandable name in to s
358
virtual void PrintName(tString &s) const;
360
virtual bool AcceptClientSync() const;
361
virtual void WriteSync(nMessage &m);
362
virtual void ReadSync(nMessage &m);
363
virtual nDescriptor& CreatorDescriptor() const;
364
virtual void InitAfterCreation();
365
virtual bool ClearToTransmit(int user) const;
367
virtual void NewObject(){} // called when we control a new object
368
virtual void RightBeforeDeath(int triesLeft){} // is called right before the vehicle gets destroyed.
371
void RemoveFromGame();
372
void ControlObject(eNetGameObject *c);
345
void SetTeamname(const char *); // set teamname to be used for my own team
346
void UpdateTeamForce(); // update team membership without checks
347
void UpdateTeam(); // update team membership
349
eTeamSet const & GetInvitations() const ; //!< teams this player is invited to
351
void CreateNewTeam(); // create a new team and join it (on the server)
352
void CreateNewTeamWish(); // express the wish to create a new team and join it
353
virtual void ReceiveControlNet(nMessage &m);// receive the team control wish
355
static bool Enemies( ePlayerNetID const * a, ePlayerNetID const * b ); //!< determines whether two players are opponents and can score points against each other
357
// print out an understandable name in to s
358
virtual void PrintName(tString &s) const;
360
virtual bool AcceptClientSync() const;
361
virtual void WriteSync(nMessage &m);
362
virtual void ReadSync(nMessage &m);
363
virtual nDescriptor& CreatorDescriptor() const;
364
virtual void InitAfterCreation();
365
virtual bool ClearToTransmit(int user) const;
367
virtual void NewObject(){} // called when we control a new object
368
virtual void RightBeforeDeath(int triesLeft){} // is called right before the vehicle gets destroyed.
371
void RemoveFromGame();
372
void ControlObject(eNetGameObject *c);
373
373
void ClearObject();
378
// suspend the player from playing, forcing him to spectate
379
void Suspend( int rounds = 5, tString reason = tString(""));
380
#ifdef KRAWALL_SERVER
381
void Authenticate( tString const & authName,
382
tAccessLevel accessLevel = tAccessLevel_Authenticated,
383
ePlayerNetID const * admin = 0 ); //!< make the authentification valid
384
void DeAuthenticate( ePlayerNetID const * admin = 0 ); //!< make the authentification invalid
385
bool IsAuthenticated() const; //!< is the authentification valid?
388
static void RequestScheduledLogins(); //!< initiates login processes for all pending wishes
390
bool IsActive() const { return !disconnected; }
392
bool IsSilenced( void ) const { return silenced_; }
393
void SetSilenced( bool silenced ) { silenced_ = silenced; }
394
bool& AccessSilenced( void ) { return silenced_; }
378
// suspend the player from playing, forcing him to spectate
379
void Suspend( int rounds = 5, tString reason = tString(""));
380
#ifdef KRAWALL_SERVER
381
void Authenticate( tString const & authName,
382
tAccessLevel accessLevel = tAccessLevel_Authenticated,
383
ePlayerNetID const * admin = 0,
384
bool messages = true ); //!< make the authentification valid
385
void DeAuthenticate( ePlayerNetID const * admin = 0 ); //!< make the authentification invalid
386
bool IsAuthenticated() const; //!< is the authentification valid?
389
static void RequestScheduledLogins(); //!< initiates login processes for all pending wishes
391
bool IsActive() const { return !disconnected; }
393
bool IsSilenced( void ) const { return silenced_; }
394
void SetSilenced( bool silenced ) { silenced_ = silenced; }
395
bool& AccessSilenced( void ) { return silenced_; }
396
397
bool IsSuspended ( void ) { return suspended_; }
397
398
bool IsSuspended ( void ) const { return suspended_; }
398
399
int RoundsSuspended() { return roundsSuspended_; }
399
400
int RoundsSuspended() const { return roundsSuspended_; }
400
tString ReasonSuspended() { return suspendReason_; }
402
static void SilenceMenu(); // menu where you can silence players
403
static void PoliceMenu(); // menu where you can silence and kick players
405
virtual bool IsHuman() const { return true; }
407
void Activity(); // call it if this player just showed some activity.
408
REAL LastActivity() const; //!< returns how long the last activity of this player was ago
410
eNetGameObject *Object() const;
412
//void SetRubber(ePlayerNetID *player, REAL rubber);
413
void AddScore(int points, const tOutput& reasonwin, const tOutput& reasonlose, bool shouldPrint=true);
414
int Score()const {return score;}
415
int TotalScore() const;
416
static void ResetScoreDifferences(); //<! Resets the last stored score so ScoreDifferences takes this as a reference time
417
static void LogScoreDifferences(); //<! Logs accumulated scores of all players since the last call to ResetScoreDifferences() to ladderlog.txt
418
static void UpdateSuspensions(); //<! Decrements the number of rounds players are suspended for
419
static void UpdateShuffleSpamTesters(); //<! Reset shuffle spam checks
420
void LogScoreDifference(); //<! Logs accumulated scores since the last call to ResetScoreDifferences() to ladderlog.txt
421
static void LogMatchScores(); //<! Logs match scores of all players to ladderlog.txt
423
void AnalyzeTiming( REAL timing ); //<! analzye a timing event for timebot detection
425
static void SortByScore(); // brings the players into the right order
426
static tString Ranking( int MAX=12, bool cut = true ); // returns a ranking list
427
static void RankingLadderLog(); // writes a small ranking list to ladderlog
401
tString ReasonSuspended() { return suspendReason_; }
403
static void SilenceMenu(); // menu where you can silence players
404
static void PoliceMenu(); // menu where you can silence and kick players
406
virtual bool IsHuman() const { return true; }
408
void Activity(); // call it if this player just showed some activity.
409
REAL LastActivity() const; //!< returns how long the last activity of this player was ago
411
eNetGameObject *Object() const;
413
//void SetRubber(ePlayerNetID *player, REAL rubber);
414
void AddScore(int points, const tOutput& reasonwin, const tOutput& reasonlose, bool shouldPrint=true);
415
int Score()const {return score;}
416
int TotalScore() const;
417
static void ResetScoreDifferences(); //<! Resets the last stored score so ScoreDifferences takes this as a reference time
418
static void LogScoreDifferences(); //<! Logs accumulated scores of all players since the last call to ResetScoreDifferences() to ladderlog.txt
419
static void UpdateSuspensions(); //<! Decrements the number of rounds players are suspended for
420
static void UpdateShuffleSpamTesters(); //<! Reset shuffle spam checks
421
void LogScoreDifference(); //<! Logs accumulated scores since the last call to ResetScoreDifferences() to ladderlog.txt
422
static void LogMatchScores(); //<! Logs match scores of all players to ladderlog.txt
424
void AnalyzeTiming( REAL timing ); //<! analzye a timing event for timebot detection
426
static void SortByScore(); // brings the players into the right order
427
static tString Ranking( int MAX=12, bool cut = true ); // returns a ranking list
428
static void RankingLadderLog(); // writes a small ranking list to ladderlog
428
429
static void GridPosLadderLog(); // writes a cycle positions to ladderlog
429
static void OnlineStatsLadderLog(); // writes the online players, teams and the numbers
430
static void ResetScore(); // resets the ranking list
432
static void DisplayScores(); // display scores on the screen
434
void GreetHighscores(tString &s); // tell him his positions in the
430
static void OnlineStatsLadderLog(); // writes the online players, teams and the numbers
431
static void ResetScore(); // resets the ranking list
433
static void DisplayScores(); // display scores on the screen
435
void GreetHighscores(tString &s); // tell him his positions in the
435
436
// highscore lists (defined in game.cpp)
437
static ePlayerNetID * ReadPlayer( std::istream & s ); //!< reads a player from the stream
439
static void Update(); // creates ePlayerNetIDs for new players
440
// and destroys those of players that have left
442
#ifdef KRAWALL_SERVER
443
static tAccessLevel AccessLevelRequiredToPlay(); // is authentication required to play on this server?
446
static bool WaitToLeaveChat(); //!< waits for players to leave chat state. Returns true if the caller should wait to proceed with whatever he wants to do.
448
static void RemoveChatbots(); //!< removes chatbots and idling players from the game
450
static void CompleteRebuild(); // same as above, but rebuilds every ePlayerNetID.
451
static void ClearAll(); // deletes all ePlayerNetIDs.
452
static void SpectateAll( bool spectate=true ); // puts all players into spectator mode.
454
static void ThrowOutDisconnected(); // get rid of everyone that disconnected from the game
456
void GetScoreFromDisconnectedCopy(); // get the player's data from the previous login
458
void Chat(const tString &s);
460
nTimeAbsolute GetTimeCreated() const { return timeCreated_; }
462
virtual void Color( REAL&r, REAL&g, REAL&b ) const;
463
virtual void TrailColor( REAL&r, REAL&g, REAL&b ) const;
465
//Remote Admin add-ins...
466
bool IsLoggedIn() const { return GetAccessLevel() < tAccessLevel_Moderator; }
467
void BeLoggedIn() { SetAccessLevel( tAccessLevel_Admin ); }
468
void BeNotLoggedIn() { SetAccessLevel( tAccessLevel_Program ); }
438
static ePlayerNetID * ReadPlayer( std::istream & s ); //!< reads a player from the stream
440
static void Update(); // creates ePlayerNetIDs for new players
441
// and destroys those of players that have left
443
#ifdef KRAWALL_SERVER
444
static tAccessLevel AccessLevelRequiredToPlay(); // is authentication required to play on this server?
447
static bool WaitToLeaveChat(); //!< waits for players to leave chat state. Returns true if the caller should wait to proceed with whatever he wants to do.
449
static void RemoveChatbots(); //!< removes chatbots and idling players from the game
451
static void CompleteRebuild(); // same as above, but rebuilds every ePlayerNetID.
452
static void ClearAll(); // deletes all ePlayerNetIDs.
453
static void SpectateAll( bool spectate=true ); // puts all players into spectator mode.
455
static void ThrowOutDisconnected(); // get rid of everyone that disconnected from the game
457
void GetScoreFromDisconnectedCopy(); // get the player's data from the previous login
459
void Chat(const tString &s);
461
nTimeAbsolute GetTimeCreated() const { return timeCreated_; }
463
virtual void Color( REAL&r, REAL&g, REAL&b ) const;
464
virtual void TrailColor( REAL&r, REAL&g, REAL&b ) const;
466
//Remote Admin add-ins...
467
bool IsLoggedIn() const { return GetAccessLevel() < tAccessLevel_Moderator; }
468
void BeLoggedIn() { SetAccessLevel( tAccessLevel_Admin ); }
469
void BeNotLoggedIn() { SetAccessLevel( tAccessLevel_Program ); }
469
470
tAccessLevel GetLastAccessLevel() const { return lastAccessLevel; }
472
473
bool HasLoggedIn() { return hasLoggedIn_; }
473
void SetLoggedIn(bool newValue) { hasLoggedIn_ = newValue; }
474
void SetLoggedIn(bool newValue) { hasLoggedIn_ = newValue; }
476
void PassFlag(std::istream &s);
477
void PassFlag(std::istream &s);
478
479
static ePlayerNetID * FindPlayerByName( tString const & name, ePlayerNetID * requester = 0, bool print=true ); //!< finds a player by name using lax name matching. Reports errors to the console or to the requesting player.
479
static ePlayerNetID * FindPlayerById(int owner_id);
481
void UpdateName(); //!< update the player name from either the client's wishes, either the admin's wishes.
482
static void FilterName( tString const & in, tString & out ); //!< filters a name (removes unprintables, color codes and spaces)
483
static tString FilterName( tString const & in ); //!< filters a name (removes unprintables, color codes and spaces)
484
bool IsAllowedToRename ( void ); //!< tells if the user can rename or not, takes care about everything
480
static ePlayerNetID * FindPlayerById(int owner_id);
482
void UpdateName(); //!< update the player name from either the client's wishes, either the admin's wishes.
483
static void FilterName( tString const & in, tString & out ); //!< filters a name (removes unprintables, color codes and spaces)
484
static tString FilterName( tString const & in ); //!< filters a name (removes unprintables, color codes and spaces)
485
bool IsAllowedToRename ( void ); //!< tells if the user can rename or not, takes care about everything
485
486
void AllowRename( bool allow ); //!< Allows a player to rename (or not)
487
488
static bool HasRenameCapability ( ePlayerNetID const *, ePlayerNetID const * admin ); //!< Checks if the admin can use the RENAME command. Used in IsAllowedToRename()
489
void LogActivity(int activity_type); //!< Log the activity of the player currently in motion
492
tColoredString nameFromClient_; //!< this player's name as the client wants it to be. Avoid using it when possilbe.
493
tColoredString nameFromServer_; //!< this player's name as the server wants it to be. Avoid using it when possilbe.
494
tColoredString nameFromAdmin_; //!< this player's name as the admin wants it to be. Avoid using it when possilbe.
495
tColoredString coloredName_; //!< this player's name, cleared by the server. Use this for onscreen screen display.
496
tString name_; //!< this player's name without colors.
497
tString userName_; //!< this player's name, cleared for system logs. Use for writing to files or comparing with admin input.
499
#ifdef KRAWALL_SERVER
500
tString rawAuthenticatedName_; //!< the raw authenticated name in user@authority form.
490
void LogActivity(int activity_type); //!< Log the activity of the player currently in motion
493
tColoredString nameFromClient_; //!< this player's name as the client wants it to be. Avoid using it when possilbe.
494
tColoredString nameFromServer_; //!< this player's name as the server wants it to be. Avoid using it when possilbe.
495
tColoredString nameFromAdmin_; //!< this player's name as the admin wants it to be. Avoid using it when possilbe.
496
tColoredString coloredName_; //!< this player's name, cleared by the server. Use this for onscreen screen display.
497
tString name_; //!< this player's name without colors.
498
tString userName_; //!< this player's name, cleared for system logs. Use for writing to files or comparing with admin input.
500
#ifdef KRAWALL_SERVER
501
tString rawAuthenticatedName_; //!< the raw authenticated name in user@authority form.
503
504
tString authenticatedname;
507
REAL wait_; //!< time in seconds WaitToLeaveChat() will wait for this player
509
void CreateVoter(); // create our voter or find it
510
void MyInitAfterCreation();
513
virtual nMachine & DoGetMachine() const; //!< returns the machine this object belongs to
516
// virtual void AddRef();
517
// virtual void Release();
521
inline tColoredString const & GetNameFromClient( void ) const; //!< Gets this player's name as the client wants it to be. Avoid using it when possilbe.
522
inline ePlayerNetID const & GetNameFromClient( tColoredString & nameFromClient ) const; //!< Gets this player's name as the client wants it to be. Avoid using it when possilbe.
523
inline tColoredString const & GetColoredName( void ) const; //!< Gets this player's name, cleared by the server. Use this for onscreen screen display.
524
inline ePlayerNetID const & GetColoredName( tColoredString & coloredName ) const; //!< Gets this player's name, cleared by the server. Use this for onscreen screen display.
525
inline tString const & GetName( void ) const; //!< Gets this player's name without colors.
526
inline ePlayerNetID const & GetName( tString & name ) const; //!< Gets this player's name without colors.
528
inline tString const & GetUserName( void ) const; //!< Gets this player's full name. Use for writing to files or comparing with admin input.
529
inline ePlayerNetID const & GetUserName( tString & userName ) const; //!< Gets this player's name, cleared for system logs. Use for writing to files or comparing with admin input.
531
tString const & GetLogName( void ) const{ return GetUserName(); } //!< Gets this player's name, cleared for system logs (with escaped special characters). Use for writing to files.
532
tString GetFilteredAuthenticatedName( void ) const; //!< Gets the filtered, ecaped authentication name
533
#ifdef KRAWALL_SERVER
534
tString const & GetRawAuthenticatedName( void ) const{ return rawAuthenticatedName_; } //!< Gets the raw, unescaped authentication name
535
void SetRawAuthenticatedName( tString const & name ){ if ( !IsAuthenticated()) rawAuthenticatedName_ = name; } //!< Sets the raw, unescaped authentication name
508
REAL wait_; //!< time in seconds WaitToLeaveChat() will wait for this player
510
void CreateVoter(); // create our voter or find it
511
void MyInitAfterCreation();
514
virtual nMachine & DoGetMachine() const; //!< returns the machine this object belongs to
517
// virtual void AddRef();
518
// virtual void Release();
522
inline tColoredString const & GetNameFromClient( void ) const; //!< Gets this player's name as the client wants it to be. Avoid using it when possilbe.
523
inline ePlayerNetID const & GetNameFromClient( tColoredString & nameFromClient ) const; //!< Gets this player's name as the client wants it to be. Avoid using it when possilbe.
524
inline tColoredString const & GetColoredName( void ) const; //!< Gets this player's name, cleared by the server. Use this for onscreen screen display.
525
inline ePlayerNetID const & GetColoredName( tColoredString & coloredName ) const; //!< Gets this player's name, cleared by the server. Use this for onscreen screen display.
526
inline tString const & GetName( void ) const; //!< Gets this player's name without colors.
527
inline ePlayerNetID const & GetName( tString & name ) const; //!< Gets this player's name without colors.
529
inline tString const & GetUserName( void ) const; //!< Gets this player's full name. Use for writing to files or comparing with admin input.
530
inline ePlayerNetID const & GetUserName( tString & userName ) const; //!< Gets this player's name, cleared for system logs. Use for writing to files or comparing with admin input.
532
tString const & GetLogName( void ) const{ return GetUserName(); } //!< Gets this player's name, cleared for system logs (with escaped special characters). Use for writing to files.
533
tString GetFilteredAuthenticatedName( void ) const; //!< Gets the filtered, ecaped authentication name
534
#ifdef KRAWALL_SERVER
535
tString const & GetRawAuthenticatedName( void ) const{ return rawAuthenticatedName_; } //!< Gets the raw, unescaped authentication name
536
void SetRawAuthenticatedName( tString const & name ){ if ( !IsAuthenticated()) rawAuthenticatedName_ = name; } //!< Sets the raw, unescaped authentication name
539
540
tString const & GetAuthenticatedName() const { return authenticatedname; }
540
void SetAuthenticatedName(tString name) { authenticatedname = name; }
542
ePlayerNetID & SetName( tString const & name ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
543
ePlayerNetID & SetName( char const * name ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
544
ePlayerNetID & SetName( tString const & name , bool force ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
545
ePlayerNetID & ForceName( tString const & name ); //!< Forces this player's name. Forces processed names (colored, username, nameFromCLient) as well.
547
inline ePlayerNetID & SetUserName( tString const & userName ); //!< Sets this player's name, cleared for system logs. Use for writing to files or comparing with admin input. The other names stay unaffected.
550
inline ePlayerNetID & SetNameFromClient( tColoredString const & nameFromClient ); //!< Sets this player's name as the client wants it to be. Avoid using it when possilbe.
551
inline ePlayerNetID & SetColoredName( tColoredString const & coloredName ); //!< Sets this player's name, cleared by the server. Use this for onscreen screen display.
554
extern tList<ePlayerNetID> se_PlayerNetIDs;
555
extern int sr_viewportBelongsToPlayer[MAX_VIEWPORTS];
557
void se_ChatState( ePlayerNetID::ChatFlags flag, bool cs);
559
void se_SaveToScoreFile( tOutput const & out ); //!< writes something to scorelog.txt
541
void SetAuthenticatedName(tString name) { authenticatedname = name; }
543
ePlayerNetID & SetName( tString const & name ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
544
ePlayerNetID & SetName( char const * name ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
545
ePlayerNetID & SetName( tString const & name , bool force ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
546
ePlayerNetID & ForceName( tString const & name ); //!< Forces this player's name. Forces processed names (colored, username, nameFromCLient) as well.
548
inline ePlayerNetID & SetUserName( tString const & userName ); //!< Sets this player's name, cleared for system logs. Use for writing to files or comparing with admin input. The other names stay unaffected.
551
inline ePlayerNetID & SetNameFromClient( tColoredString const & nameFromClient ); //!< Sets this player's name as the client wants it to be. Avoid using it when possilbe.
552
inline ePlayerNetID & SetColoredName( tColoredString const & coloredName ); //!< Sets this player's name, cleared by the server. Use this for onscreen screen display.
555
extern tList<ePlayerNetID> se_PlayerNetIDs;
556
extern int sr_viewportBelongsToPlayer[MAX_VIEWPORTS];
558
void se_ChatState( ePlayerNetID::ChatFlags flag, bool cs);
560
void se_SaveToScoreFile( tOutput const & out ); //!< writes something to scorelog.txt
560
561
void se_SaveToChatLog( tOutput const & out ); //!< writes something to chatlog.txt (if enabled) and/or ladderlog
561
562
void se_SaveToLadderLog( tOutput const & out ); //!< writes something to ladderlog.txt
562
void se_SaveToChatLogC( tOutput const &out ); //!< writes something to chatlog_color.txt
564
//! create a global instance of this to write stuff to ladderlog.txt
565
class eLadderLogWriter {
566
static std::list<eLadderLogWriter *> &writers();
569
tSettingItem<bool> *conf;
570
tColoredString cache;
572
eLadderLogWriter(char const *ID, bool enabledByDefault);
574
//! append a field to the current message. Spaces are added automatically.
575
template<typename T> eLadderLogWriter &operator<<(T const &s) {
581
void write(); //!< send to ladderlog and clear message
583
bool isEnabled() { return enabled; } //!< check this if you're going to make expensive calculations for ladderlog output
585
static void setAll(bool enabled); //!< enable or disable all writers
563
void se_SaveToChatLogC( tOutput const &out ); //!< writes something to chatlog_color.txt
565
//! create a global instance of this to write stuff to ladderlog.txt
566
class eLadderLogWriter {
567
static std::list<eLadderLogWriter *> &writers();
570
tSettingItem<bool> *conf;
571
tColoredString cache;
573
eLadderLogWriter(char const *ID, bool enabledByDefault);
575
//! append a field to the current message. Spaces are added automatically.
576
template<typename T> eLadderLogWriter &operator<<(T const &s) {
582
void write(); //!< send to ladderlog and clear message
584
bool isEnabled() { return enabled; } //!< check this if you're going to make expensive calculations for ladderlog output
586
static void setAll(bool enabled); //!< enable or disable all writers
594
595
ACTIVITY_JOINED_GAME_FROM_SPECTATOR,
595
596
ACTIVITY_FINISHED_RACE,
599
tColoredString & operator << (tColoredString &s,const ePlayer &p);
600
tColoredString & operator << (tColoredString &s,const ePlayerNetID &p);
602
extern int pingCharity;
604
void se_AutoShowScores(); // show scores based on automated decision
605
void se_UserShowScores(bool show); // show scores based on user input
606
void se_SetShowScoresAuto(bool a); // disable/enable auto show scores
609
void se_DeletePasswords();
610
extern int se_PasswordStorageMode; // 0: store in memory, -1: don't store, 1: store on file
612
tOutput& operator << (tOutput& o, const ePlayerNetID& p);
615
class eCallbackGreeting: public tCallbackString
617
static tCallbackString *anchor;
618
static ePlayerNetID* greeted;
621
static tString Greet(ePlayerNetID* player);
622
static ePlayerNetID* Greeted(){return greeted;}
624
eCallbackGreeting(STRINGRETFUNC* f);
627
void ForceName ( std::istream & s );
629
// ******************************************************************************************
631
// * GetNameFromClient
633
// ******************************************************************************************
635
//! @return this player's name as the client wants it to be. Avoid using it when possilbe.
637
// ******************************************************************************************
639
tColoredString const & ePlayerNetID::GetNameFromClient( void ) const
641
return this->nameFromClient_;
644
// ******************************************************************************************
646
// * GetNameFromClient
648
// ******************************************************************************************
650
//! @param nameFromClient this player's name as the client wants it to be. Avoid using it when possilbe. to fill
651
//! @return A reference to this to allow chaining
653
// ******************************************************************************************
655
ePlayerNetID const & ePlayerNetID::GetNameFromClient( tColoredString & nameFromClient ) const
657
nameFromClient = this->nameFromClient_;
661
// ******************************************************************************************
663
// * SetNameFromClient
665
// ******************************************************************************************
667
//! @param nameFromClient this player's name as the client wants it to be. Avoid using it when possilbe. to set
668
//! @return A reference to this to allow chaining
670
// ******************************************************************************************
672
ePlayerNetID & ePlayerNetID::SetNameFromClient( tColoredString const & nameFromClient )
674
this->nameFromClient_ = nameFromClient;
678
// ******************************************************************************************
682
// ******************************************************************************************
684
//! @return this player's name, cleared by the server. Use this for onscreen screen display.
686
// ******************************************************************************************
688
tColoredString const & ePlayerNetID::GetColoredName( void ) const
690
return this->coloredName_;
693
// ******************************************************************************************
697
// ******************************************************************************************
699
//! @param coloredName this player's name, cleared by the server. Use this for onscreen screen display. to fill
700
//! @return A reference to this to allow chaining
702
// ******************************************************************************************
704
ePlayerNetID const & ePlayerNetID::GetColoredName( tColoredString & coloredName ) const
706
coloredName = this->coloredName_;
710
// ******************************************************************************************
714
// ******************************************************************************************
716
//! @param coloredName this player's name, cleared by the server. Use this for onscreen screen display. to set
717
//! @return A reference to this to allow chaining
719
// ******************************************************************************************
721
ePlayerNetID & ePlayerNetID::SetColoredName( tColoredString const & coloredName )
723
this->coloredName_ = coloredName;
727
// ******************************************************************************************
731
// ******************************************************************************************
733
//! @return this player's name without colors.
735
// ******************************************************************************************
737
tString const & ePlayerNetID::GetName( void ) const
742
// ******************************************************************************************
746
// ******************************************************************************************
748
//! @param name this player's name without colors. to fill
749
//! @return A reference to this to allow chaining
751
// ******************************************************************************************
753
ePlayerNetID const & ePlayerNetID::GetName( tString & name ) const
759
// ******************************************************************************************
763
// ******************************************************************************************
765
//! @return this player's name, cleared for system logs. Use for writing to files or comparing with admin input.
767
// ******************************************************************************************
769
tString const & ePlayerNetID::GetUserName( void ) const
771
return this->userName_;
774
// ******************************************************************************************
778
// ******************************************************************************************
780
//! @param userName this player's name, cleared for system logs. Use for writing to files or comparing with admin input. to fill
781
//! @return A reference to this to allow chaining
783
// ******************************************************************************************
785
ePlayerNetID const & ePlayerNetID::GetUserName( tString & userName ) const
787
userName = this->userName_;
791
// ******************************************************************************************
795
// ******************************************************************************************
797
//! @param userName this player's name, cleared for system logs. Use for writing to files or comparing with admin input. to set
798
//! @return A reference to this to allow chaining
800
// ******************************************************************************************
802
ePlayerNetID & ePlayerNetID::SetUserName( tString const & userName )
804
this->userName_ = userName;
600
tColoredString & operator << (tColoredString &s,const ePlayer &p);
601
tColoredString & operator << (tColoredString &s,const ePlayerNetID &p);
603
extern int pingCharity;
605
void se_AutoShowScores(); // show scores based on automated decision
606
void se_UserShowScores(bool show); // show scores based on user input
607
void se_SetShowScoresAuto(bool a); // disable/enable auto show scores
610
void se_DeletePasswords();
611
extern int se_PasswordStorageMode; // 0: store in memory, -1: don't store, 1: store on file
613
tOutput& operator << (tOutput& o, const ePlayerNetID& p);
616
class eCallbackGreeting: public tCallbackString
618
static tCallbackString *anchor;
619
static ePlayerNetID* greeted;
622
static tString Greet(ePlayerNetID* player);
623
static ePlayerNetID* Greeted(){return greeted;}
625
eCallbackGreeting(STRINGRETFUNC* f);
628
void ForceName ( std::istream & s );
630
// ******************************************************************************************
632
// * GetNameFromClient
634
// ******************************************************************************************
636
//! @return this player's name as the client wants it to be. Avoid using it when possilbe.
638
// ******************************************************************************************
640
tColoredString const & ePlayerNetID::GetNameFromClient( void ) const
642
return this->nameFromClient_;
645
// ******************************************************************************************
647
// * GetNameFromClient
649
// ******************************************************************************************
651
//! @param nameFromClient this player's name as the client wants it to be. Avoid using it when possilbe. to fill
652
//! @return A reference to this to allow chaining
654
// ******************************************************************************************
656
ePlayerNetID const & ePlayerNetID::GetNameFromClient( tColoredString & nameFromClient ) const
658
nameFromClient = this->nameFromClient_;
662
// ******************************************************************************************
664
// * SetNameFromClient
666
// ******************************************************************************************
668
//! @param nameFromClient this player's name as the client wants it to be. Avoid using it when possilbe. to set
669
//! @return A reference to this to allow chaining
671
// ******************************************************************************************
673
ePlayerNetID & ePlayerNetID::SetNameFromClient( tColoredString const & nameFromClient )
675
this->nameFromClient_ = nameFromClient;
679
// ******************************************************************************************
683
// ******************************************************************************************
685
//! @return this player's name, cleared by the server. Use this for onscreen screen display.
687
// ******************************************************************************************
689
tColoredString const & ePlayerNetID::GetColoredName( void ) const
691
return this->coloredName_;
694
// ******************************************************************************************
698
// ******************************************************************************************
700
//! @param coloredName this player's name, cleared by the server. Use this for onscreen screen display. to fill
701
//! @return A reference to this to allow chaining
703
// ******************************************************************************************
705
ePlayerNetID const & ePlayerNetID::GetColoredName( tColoredString & coloredName ) const
707
coloredName = this->coloredName_;
711
// ******************************************************************************************
715
// ******************************************************************************************
717
//! @param coloredName this player's name, cleared by the server. Use this for onscreen screen display. to set
718
//! @return A reference to this to allow chaining
720
// ******************************************************************************************
722
ePlayerNetID & ePlayerNetID::SetColoredName( tColoredString const & coloredName )
724
this->coloredName_ = coloredName;
728
// ******************************************************************************************
732
// ******************************************************************************************
734
//! @return this player's name without colors.
736
// ******************************************************************************************
738
tString const & ePlayerNetID::GetName( void ) const
743
// ******************************************************************************************
747
// ******************************************************************************************
749
//! @param name this player's name without colors. to fill
750
//! @return A reference to this to allow chaining
752
// ******************************************************************************************
754
ePlayerNetID const & ePlayerNetID::GetName( tString & name ) const
760
// ******************************************************************************************
764
// ******************************************************************************************
766
//! @return this player's name, cleared for system logs. Use for writing to files or comparing with admin input.
768
// ******************************************************************************************
770
tString const & ePlayerNetID::GetUserName( void ) const
772
return this->userName_;
775
// ******************************************************************************************
779
// ******************************************************************************************
781
//! @param userName this player's name, cleared for system logs. Use for writing to files or comparing with admin input. to fill
782
//! @return A reference to this to allow chaining
784
// ******************************************************************************************
786
ePlayerNetID const & ePlayerNetID::GetUserName( tString & userName ) const
788
userName = this->userName_;
792
// ******************************************************************************************
796
// ******************************************************************************************
798
//! @param userName this player's name, cleared for system logs. Use for writing to files or comparing with admin input. to set
799
//! @return A reference to this to allow chaining
801
// ******************************************************************************************
803
ePlayerNetID & ePlayerNetID::SetUserName( tString const & userName )
805
this->userName_ = userName;
808
809
ePlayerNetID *se_GetLocalPlayer();
809
extern bool se_highlightMyName, se_tabCompletion, se_tabCompletionWithColors;
810
extern bool se_highlightMyName, se_tabCompletion, se_tabCompletionWithColors;