1 /*
2 
3 *************************************************************************
4 
5 ArmageTron -- Just another Tron Lightcycle Game in 3D.
6 Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
7 
8 **************************************************************************
9 
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.
14 
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.
19 
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.
23 
24 ***************************************************************************
25 
26 */
27 
28 #ifndef ArmageTron_PLAYER_H
29 #define ArmageTron_PLAYER_H
30 
31 #ifndef MAX_INSTANT_CHAT
32 #define MAX_INSTANT_CHAT 25
33 #endif
34 
35 #define MAX_PLAYERS 4
36 
37 #include "rSDL.h"
38 
39 #include "uInput.h"
40 #include "tList.h"
41 #include "tString.h"
42 #include "eCamera.h"
43 #include "eNetGameObject.h"
44 #include "tCallbackString.h"
45 #include "nSpamProtection.h"
46 
47 #include <set>
48 #include <list>
49 #include <utility>
50 #include "eChat.h"
51 
52 
53 #define PLAYER_CONFITEMS (30+MAX_INSTANT_CHAT)
54 
55 // maximal length of chat message
56 extern int se_SpamMaxLen;
57 
58 // Maximum number of chat entries to save for spam analysis
59 extern int se_lastSaidMaxEntries;
60 
61 // time during which no repeaded chat messages are printed
62 extern REAL se_alreadySaidTimeout;
63 
64 // minimal access level for chat
65 extern tAccessLevel se_chatAccessLevel;
66 
67 // time between public chat requests, set to 0 to disable
68 extern REAL se_chatRequestTimeout;
69 
70 
71 // call on commands that only work on the server; quit if it returns true
72 bool se_NeedsServer(char const * command, std::istream & s, bool strict = true );
73 
74 class tConfItemBase;
75 class uAction;
76 class tOutput;
77 class eTeam;
78 class eVoter;
79 
80 class ePlayer: public uPlayerPrototype{
81     friend class eMenuItemChat;
82     static uActionPlayer s_chat;
83 
84     tConfItemBase *configuration[PLAYER_CONFITEMS];
85     int            CurrentConfitem;
86     void   StoreConfitem(tConfItemBase *c);
87     void   DeleteConfitems();
88 public:
89     tString    name;                 // the player's screen name
90     tString    globalID;             // the global ID of the player in user@authority form
91     // REAL	   rubberstatus;
92     bool       centerIncamOnTurn;
93     bool       wobbleIncam;
94     bool       autoSwitchIncam;
95 
96     bool       spectate;              // shall this player always spectate?
97     bool       stealth;               // does this player wish to hide his/her identity?
98     bool       autoLogin;             // should the player always request authentication on servers?
99 
100     bool 		nameTeamAfterMe; // player prefers to call his team after his name
101     int			favoriteNumberOfPlayersPerTeam;
102 
103     eCamMode startCamera;
104     bool     allowCam[10];
105     int      startFOV;
106     bool     smartCustomGlance; //!< flag making the smart camera use the custom settings for glancing
107 
108     tCHECKED_PTR(eCamera)           cam;
109     tCONTROLLED_PTR(ePlayerNetID) netPlayer;
110 
111     int rgb[3]; // our color
112 
113     tString instantChatString[MAX_INSTANT_CHAT];
114     // instant chat macros
115 
116     static uActionPlayer *se_instantChatAction[MAX_INSTANT_CHAT];
117 
118     ePlayer();
119     virtual ~ePlayer();
120 
Name()121     virtual const char *Name() const{return name;}
122 
123     virtual bool Act(uAction *act,REAL x);
124 
ID()125     int ID() const {return id;}
126 #ifndef DEDICATED
127     void Render();
128 #endif
129 
130     static ePlayer * PlayerConfig(int p);
131 
132     static bool PlayerIsInGame(int p);
133 
134     static rViewport * PlayerViewport(int p);
135 
136     static void LogIn();          //!< sends authentication login messages for all local players
137     static void SendAuthNames();  //!< sends authentication names and authentication wishes for all local players
138 
139     static void Init();
140     static void Exit();
141 };
142 
143 //! class managing access levels.
144 class eAccessLevelHolder
145 {
146 public:
147     eAccessLevelHolder();
148 
GetAccessLevel()149     tAccessLevel GetAccessLevel() const { return accessLevel; }
150     void SetAccessLevel( tAccessLevel level );
151 
152 private:
153     tAccessLevel     accessLevel;    //!< admin access level of the current user
154 };
155 
156 // the class that identifies players across the network
157 class ePlayerNetID: public nNetObject, public eAccessLevelHolder{
158     friend class ePlayer;
159     friend class eTeam;
160     friend class eNetGameObject;
161     friend class tControlledPTR< ePlayerNetID >;
162     // access level. lower numeric values are better.
163 public:
164     typedef std::set< eTeam * > eTeamSet;
165 private:
166 
167     int listID;                          // ID in the list of all players
168     int teamListID;                      // ID in the list of the team
169 
170     bool							silenced_;		// flag indicating whether the player has been silenced
171     int                             suspended_;     //! number of rounds the player is currently suspended from playing
172 
173     nTimeAbsolute                   timeCreated_;   // the time the player was created
174     nTimeAbsolute					timeJoinedTeam; // the time the player joined the team he is in now
175     tCONTROLLED_PTR(eTeam)			nextTeam;		// the team we're in ( logically )
176     tCONTROLLED_PTR(eTeam)			currentTeam;	// the team we currently are spawned for
177     eTeamSet                        invitations_;   // teams this player is invited to
178     tCONTROLLED_PTR(eVoter)			voter_;			// voter assigned to this player
179 
180     tCHECKED_PTR(eNetGameObject) object; // the object this player is
181     // controlling
182 
183     int score; // points made so far
184     int lastScore_; // last saved score
185 
186     int favoriteNumberOfPlayersPerTeam;		// join team if number of players on it is less than this; create new team otherwise
187     bool nameTeamAfterMe; 					// player prefers to call his team after his name
188     bool greeted;        					// did the server already greet him?
189     bool disconnected;   					// did he disconnect from the game?
190 
191     static void SwapPlayersNo(int a,int b); // swaps the players a and b
192 
193     ePlayerNetID& operator= (const ePlayerNetID&); // forbid copy constructor
194 
195     bool			spectating_; //!< are we currently spectating? Spectators don't get assigned to teams.
196     bool			stealth_; //!< does this player want to hide his/her identity?
197     bool			chatting_;   //!< are we currently chatting?
198     int				chatFlags_;  //!< different types of reasons for beeing chatting
199     bool			allowTeamChange_; //!< allow team changes even if ALLOW_TEAM_CHANGE is disabled?
200 
201     //For improved remoteadmin
202     tAccessLevel     lastAccessLevel;//!< access level at the time of the last name update
203 
204     nMachine *      registeredMachine_; //!< the machine the player is registered with
205     void RegisterWithMachine();         //!< registers with a machine
206     void UnregisterWithMachine();       //!< un registers with a machine
207 public:
208     enum			ChatFlags
209     {
210         ChatFlags_Chat = 1,
211         ChatFlags_Away = 2,
212         ChatFlags_Menu = 4,
213         ChatFlags_Console = 4
214     };
215 
216     int    pID;
217     // REAL	rubberstatus;
218 
219     unsigned short r,g,b; // our color
220 
221     unsigned short pingCharity; // max ping you are willing to take over
222 
223     REAL ping;
224 
225     double lastSync;         //!< time of the last sync request
226     double lastActivity_;    //!< time of the last activity
227 
228     bool loginWanted;        //!< flag indicating whether this player currently wants to log on
229 
230     bool renameAllowed_;     //!< specifies if the player is allowed to rename or not, does not know about votes.
231 
232     nSpamProtection chatSpam_;
233 
234     eChatLastSaid lastSaid_; //!< last said information
235     eShuffleSpamTester shuffleSpam;
236 
237     ePlayerNetID(int p=-1);
238     ePlayerNetID(nMessage &m);
239     virtual ~ePlayerNetID();
240 
241     virtual bool ActionOnQuit();
242     virtual void ActionOnDelete();
243 
244     // chatting
IsChatting()245     bool IsChatting() const { return chatting_; }
246     void SetChatting ( ChatFlags flag, bool chatting );
247 
248     // spectating
IsSpectating()249     bool IsSpectating() const { return spectating_; }
250 
StealthMode()251     bool StealthMode() const { return stealth_; }
252 
253     // team management
254     bool TeamChangeAllowed( bool informPlayer = false ) const; //!< is this player allowed to change teams?
SetTeamChangeAllowed(bool allowed)255     void SetTeamChangeAllowed(bool allowed) {allowTeamChange_ = allowed;} //!< set if this player should always be allowed to change teams
NextTeam()256     eTeam* NextTeam()    const { return nextTeam; }				// return the team I will be next round
CurrentTeam()257     eTeam* CurrentTeam() const { return currentTeam; }		// return the team I am in
TeamListID()258     int  TeamListID() const { return teamListID; }		// return my position in the team
259     void FindDefaultTeam();									// look for a good default team for us
260     void SetTeamForce(eTeam* team );                 	// register me in the given team without checks
261     void SetTeam(eTeam* team);          	// register me in the given team (callable on the server)
262     void SetTeamWish(eTeam* team); 				// express the wish to be part of the given team (always callable)
263     void UpdateTeamForce();							// update team membership without checks
264     void UpdateTeam();							// update team membership
265 
266     eTeamSet const & GetInvitations() const ;   //!< teams this player is invited to
267 
268     void CreateNewTeam(); 	    				// create a new team and join it (on the server)
269     void CreateNewTeamWish();	 				// express the wish to create a new team and join it
270     virtual void ReceiveControlNet(nMessage &m);// receive the team control wish
271 
272     static bool Enemies( ePlayerNetID const * a, ePlayerNetID const * b ); //!< determines whether two players are opponents and can score points against each other
273 
274     // print out an understandable name in to s
275     virtual void 			PrintName(tString &s) const;
276 
277     virtual bool 			AcceptClientSync() const;
278     static  bool 			AcceptClientSyncStatic();
279     virtual void 			WriteSync(nMessage &m);
280     virtual void 			ReadSync(nMessage &m);
281     virtual nDescriptor&	CreatorDescriptor() const;
282     virtual void			InitAfterCreation();
283     virtual bool			ClearToTransmit(int user) const;
284 
NewObject()285     virtual void 			NewObject(){}        				// called when we control a new object
RightBeforeDeath(int triesLeft)286     virtual void 			RightBeforeDeath(int triesLeft){} 	// is called right before the vehicle gets destroyed.
287 
288 
289     void RemoveFromGame();
290     void ControlObject(eNetGameObject *c);
291     void ClearObject();
292 
293     void Greet();
294 
295     // suspend the player from playing, forcing him to spectate
296     void Suspend( int rounds = 5 );
297 #ifdef KRAWALL_SERVER
298     void Authenticate( tString const & authName,
299                        tAccessLevel accessLevel = tAccessLevel_Authenticated,
300                        ePlayerNetID const * admin = 0 );    //!< make the authentification valid
301     void DeAuthenticate( ePlayerNetID const * admin = 0 );  //!< make the authentification invalid
302     bool IsAuthenticated() const;                     //!< is the authentification valid?
303 #endif
304 
305     static void RequestScheduledLogins();  //!< initiates login processes for all pending wishes
306 
IsActive()307     bool IsActive() const { return !disconnected; }
308 
IsSilenced(void)309     bool IsSilenced( void ) const { return silenced_; }
SetSilenced(bool silenced)310     void SetSilenced( bool silenced ) { silenced_ = silenced; }
AccessSilenced(void)311     bool& AccessSilenced( void ) { return silenced_; }
312 
IsSuspended(void)313     bool IsSuspended ( void ) { return suspended_ > 0; }
314 
GetVoter()315     eVoter * GetVoter() const {return voter_;}     // returns our voter
316     void CreateVoter();						// create our voter or find it
317     static void SilenceMenu();				// menu where you can silence players
318     static void PoliceMenu();				// menu where you can silence and kick players
319 
IsHuman()320     virtual bool IsHuman() const { return true; }
321 
322     void Activity(); // call it if this player just showed some activity.
323     REAL LastActivity() const; //!< returns how long the last activity of this player was ago
324 
325     eNetGameObject *Object() const;
326 
327     // void SetRubber(REAL rubber2);
328     void AddScore(int points, const tOutput& reasonwin, const tOutput& reasonlose);
Score()329     int Score()const {return score;}
330     int TotalScore() const;
331     static void ResetScoreDifferences(); //<! Resets the last stored score so ScoreDifferences takes this as a reference time
332     static void LogScoreDifferences();   //<! Logs accumulated scores of all players since the last call to ResetScoreDifferences() to ladderlog.txt
333     static void UpdateSuspensions();     //<! Decrements the number of rounds players are suspended for
334     static void UpdateShuffleSpamTesters();    //<! Reset shuffle spam checks
335     void LogScoreDifference();           //<! Logs accumulated scores since the last call to ResetScoreDifferences() to ladderlog.txt
336 
337     static void SortByScore(); // brings the players into the right order
338     static tString Ranking( int MAX=12, bool cut = true );     // returns a ranking list
339     static void RankingLadderLog();     // writes a small ranking list to ladderlog
340     static void  ResetScore();  // resets the ranking list
341 
342     static void DisplayScores(); // display scores on the screen
343 
344     void GreetHighscores(tString &s); // tell him his positions in the
345     // highscore lists (defined in game.cpp)
346 
347     static void Update();           // creates ePlayerNetIDs for new players
348     // and destroys those of players that have left
349 
350 #ifdef KRAWALL_SERVER
351     static tAccessLevel AccessLevelRequiredToPlay(); // is authentication required to play on this server?
352 #endif
353 
354     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.
355 
356     static void RemoveChatbots(); //!< removes chatbots and idling players from the game
357 
358     static void CompleteRebuild(); // same as above, but rebuilds every ePlayerNetID.
359     static void ClearAll(); // deletes all ePlayerNetIDs.
360     static void SpectateAll( bool spectate=true ); // puts all players into spectator mode.
361 
362     static void ThrowOutDisconnected(); // get rid of everyone that disconnected from the game
363 
364     void GetScoreFromDisconnectedCopy(); // get the player's data from the previous login
365 
366     void Chat(const tString &s);
367 
GetTimeCreated()368     nTimeAbsolute GetTimeCreated() const { return timeCreated_; }
369 
370     virtual void Color( REAL&r, REAL&g, REAL&b ) const;
371     virtual void TrailColor( REAL&r, REAL&g, REAL&b ) const;
372 
373     //Remote Admin add-ins...
IsLoggedIn()374     bool IsLoggedIn() const { return GetAccessLevel() < tAccessLevel_Moderator; }
BeLoggedIn()375     void BeLoggedIn() { SetAccessLevel( tAccessLevel_Admin ); }
BeNotLoggedIn()376     void BeNotLoggedIn() { SetAccessLevel( tAccessLevel_Program ); }
GetLastAccessLevel()377     tAccessLevel GetLastAccessLevel() const { return lastAccessLevel; }
378 
379     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.
380 
381     void UpdateName();                                           //!< update the player name from either the client's wishes, either the admin's wishes.
382     static void FilterName( tString const & in, tString & out ); //!< filters a name (removes unprintables, color codes and spaces)
383     static tString FilterName( tString const & in );             //!< filters a name (removes unprintables, color codes and spaces)
384     bool IsAllowedToRename ( void );                             //!< tells if the user can rename or not, takes care about everything
385     void AllowRename( bool allow );                              //!< Allows a player to rename (or not)
386 
387     static bool HasRenameCapability ( ePlayerNetID const *, ePlayerNetID const * admin ); //!< Checks if the admin can use the RENAME command. Used in IsAllowedToRename()
388 
389 private:
390     tColoredString  nameFromClient_;        //!< this player's name as the client wants it to be. Avoid using it when possilbe.
391     tColoredString  nameFromServer_;        //!< this player's name as the server wants it to be. Avoid using it when possilbe.
392     tColoredString  nameFromAdmin_;         //!< this player's name as the admin wants it to be. Avoid using it when possilbe.
393     tColoredString  coloredName_;           //!< this player's name, cleared by the server. Use this for onscreen screen display.
394     tString         name_;                  //!< this player's name without colors.
395     tString         userName_;              //!< this player's name, cleared for system logs. Use for writing to files or comparing with admin input.
396 
397 #ifdef KRAWALL_SERVER
398     tString         rawAuthenticatedName_;  //!< the raw authenticated name in user@authority form.
399 #endif
400 
401     REAL            wait_;                  //!< time in seconds WaitToLeaveChat() will wait for this player
402 
403     void			MyInitAfterCreation();
404 
405 protected:
406     virtual nMachine & DoGetMachine() const;  //!< returns the machine this object belongs to
407 
408     // private:
409     //	virtual void AddRef();
410     //	virtual void Release();
411 
412     // accessors
413 public:
414     inline tColoredString const & GetNameFromClient( void ) const;	//!< Gets this player's name as the client wants it to be. Avoid using it when possilbe.
415     inline ePlayerNetID const & GetNameFromClient( tColoredString & nameFromClient ) const;	//!< Gets this player's name as the client wants it to be. Avoid using it when possilbe.
416     inline tColoredString const & GetColoredName( void ) const;	//!< Gets this player's name, cleared by the server. Use this for onscreen screen display.
417     inline ePlayerNetID const & GetColoredName( tColoredString & coloredName ) const;	//!< Gets this player's name, cleared by the server. Use this for onscreen screen display.
418     inline tString const & GetName( void ) const;	//!< Gets this player's name without colors.
419     inline ePlayerNetID const & GetName( tString & name ) const;	//!< Gets this player's name without colors.
420 
421     inline tString const & GetUserName( void ) const;	//!< Gets this player's full name. Use for writing to files or comparing with admin input.
422     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.
423 
GetLogName(void)424     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.
425     tString GetFilteredAuthenticatedName( void ) const;	//!< Gets the filtered, ecaped authentication name
426 #ifdef KRAWALL_SERVER
GetRawAuthenticatedName(void)427     tString const & GetRawAuthenticatedName( void ) const{ return rawAuthenticatedName_; }	//!< Gets the raw, unescaped authentication name
SetRawAuthenticatedName(tString const & name)428     void SetRawAuthenticatedName( tString const & name ){ if ( !IsAuthenticated()) rawAuthenticatedName_ = name; }	//!< Sets the raw, unescaped authentication name
429 #endif
430 
431     ePlayerNetID & SetName( tString const & name ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
432     ePlayerNetID & SetName( char    const * name ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
433     ePlayerNetID & SetName( tString const & name , bool force ); //!< Sets this player's name. Sets processed names (colored, username, nameFromCLient) as well.
434     ePlayerNetID & ForceName( tString const & name ); //!< Forces this player's name. Forces processed names (colored, username, nameFromCLient) as well.
435 
436     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.
437 
438 private:
439     inline ePlayerNetID & SetNameFromClient( tColoredString const & nameFromClient );   //!< Sets this player's name as the client wants it to be. Avoid using it when possilbe.
440     inline ePlayerNetID & SetColoredName( tColoredString const & coloredName ); //!< Sets this player's name, cleared by the server. Use this for onscreen screen display.
441 
442     //! accesses the suspension count
443     int & AccessSuspended();
444 
445     //! returns the suspension count
446     int GetSuspended() const;
447 };
448 
449 extern tList<ePlayerNetID> se_PlayerNetIDs;
450 extern int    sr_viewportBelongsToPlayer[MAX_VIEWPORTS];
451 
452 void se_ChatState( ePlayerNetID::ChatFlags flag, bool cs);
453 
454 void se_SaveToScoreFile( tOutput const & out );  //!< writes something to scorelog.txt
455 void se_SaveToChatLog( tOutput const & out );  //!< writes something to chatlog.txt (if enabled) and/or ladderlog
456 
457 //! create a global instance of this to write stuff to ladderlog.txt
458 class eLadderLogWriter {
459     static std::list<eLadderLogWriter *> &writers();
460     tString id;
461     bool enabled;
462     tSettingItem<bool> *conf;
463     tColoredString cache;
464 public:
465     eLadderLogWriter(char const *ID, bool enabledByDefault);
466     ~eLadderLogWriter();
467     //! append a field to the current message. Spaces are added automatically.
468     template<typename T> eLadderLogWriter &operator<<(T const &s) {
469         if(enabled) {
470             cache << ' ' << s;
471         }
472         return *this;
473     }
474     void write(); //!< send to ladderlog and clear message
475 
isEnabled()476     bool isEnabled() { return enabled; } //!< check this if you're going to make expensive calculations for ladderlog output
477 
478     static void setAll(bool enabled); //!< enable or disable all writers
479 };
480 
481 tColoredString & operator << (tColoredString &s,const ePlayer &p);
482 tColoredString & operator << (tColoredString &s,const ePlayerNetID &p);
483 
484 extern int pingCharity;
485 
486 void se_AutoShowScores(); // show scores based on automated decision
487 void se_UserShowScores(bool show); // show scores based on user input
488 void se_SetShowScoresAuto(bool a); // disable/enable auto show scores
489 
490 //Password stuff
491 void se_DeletePasswords();
492 extern int se_PasswordStorageMode; // 0: store in memory, -1: don't store, 1: store on file
493 
494 tOutput& operator << (tOutput& o, const ePlayerNetID& p);
495 
496 // greeting callback
497 class eCallbackGreeting: public tCallbackString
498 {
499     static tCallbackString *anchor;
500     static ePlayerNetID* greeted;
501 
502 public:
503     static tString Greet(ePlayerNetID* player);
Greeted()504     static ePlayerNetID* Greeted(){return greeted;}
505 
506     eCallbackGreeting(STRINGRETFUNC* f);
507 };
508 
509 void ForceName ( std::istream & s );
510 
511 // ******************************************************************************************
512 // *
513 // *	GetNameFromClient
514 // *
515 // ******************************************************************************************
516 //!
517 //!		@return		this player's name as the client wants it to be. Avoid using it when possilbe.
518 //!
519 // ******************************************************************************************
520 
GetNameFromClient(void)521 tColoredString const & ePlayerNetID::GetNameFromClient( void ) const
522 {
523     return this->nameFromClient_;
524 }
525 
526 // ******************************************************************************************
527 // *
528 // *	GetNameFromClient
529 // *
530 // ******************************************************************************************
531 //!
532 //!		@param	nameFromClient	this player's name as the client wants it to be. Avoid using it when possilbe. to fill
533 //!		@return		A reference to this to allow chaining
534 //!
535 // ******************************************************************************************
536 
GetNameFromClient(tColoredString & nameFromClient)537 ePlayerNetID const & ePlayerNetID::GetNameFromClient( tColoredString & nameFromClient ) const
538 {
539     nameFromClient = this->nameFromClient_;
540     return *this;
541 }
542 
543 // ******************************************************************************************
544 // *
545 // *	SetNameFromClient
546 // *
547 // ******************************************************************************************
548 //!
549 //!		@param	nameFromClient	this player's name as the client wants it to be. Avoid using it when possilbe. to set
550 //!		@return		A reference to this to allow chaining
551 //!
552 // ******************************************************************************************
553 
SetNameFromClient(tColoredString const & nameFromClient)554 ePlayerNetID & ePlayerNetID::SetNameFromClient( tColoredString const & nameFromClient )
555 {
556     this->nameFromClient_ = nameFromClient;
557     return *this;
558 }
559 
560 // ******************************************************************************************
561 // *
562 // *	GetColoredName
563 // *
564 // ******************************************************************************************
565 //!
566 //!		@return		this player's name, cleared by the server. Use this for onscreen screen display.
567 //!
568 // ******************************************************************************************
569 
GetColoredName(void)570 tColoredString const & ePlayerNetID::GetColoredName( void ) const
571 {
572     return this->coloredName_;
573 }
574 
575 // ******************************************************************************************
576 // *
577 // *	GetColoredName
578 // *
579 // ******************************************************************************************
580 //!
581 //!		@param	coloredName	this player's name, cleared by the server. Use this for onscreen screen display. to fill
582 //!		@return		A reference to this to allow chaining
583 //!
584 // ******************************************************************************************
585 
GetColoredName(tColoredString & coloredName)586 ePlayerNetID const & ePlayerNetID::GetColoredName( tColoredString & coloredName ) const
587 {
588     coloredName = this->coloredName_;
589     return *this;
590 }
591 
592 // ******************************************************************************************
593 // *
594 // *	SetColoredName
595 // *
596 // ******************************************************************************************
597 //!
598 //!		@param	coloredName	this player's name, cleared by the server. Use this for onscreen screen display. to set
599 //!		@return		A reference to this to allow chaining
600 //!
601 // ******************************************************************************************
602 
SetColoredName(tColoredString const & coloredName)603 ePlayerNetID & ePlayerNetID::SetColoredName( tColoredString const & coloredName )
604 {
605     this->coloredName_ = coloredName;
606     return *this;
607 }
608 
609 // ******************************************************************************************
610 // *
611 // *	GetName
612 // *
613 // ******************************************************************************************
614 //!
615 //!		@return		this player's name without colors.
616 //!
617 // ******************************************************************************************
618 
GetName(void)619 tString const & ePlayerNetID::GetName( void ) const
620 {
621     return this->name_;
622 }
623 
624 // ******************************************************************************************
625 // *
626 // *	GetName
627 // *
628 // ******************************************************************************************
629 //!
630 //!		@param	name	this player's name without colors. to fill
631 //!		@return		A reference to this to allow chaining
632 //!
633 // ******************************************************************************************
634 
GetName(tString & name)635 ePlayerNetID const & ePlayerNetID::GetName( tString & name ) const
636 {
637     name = this->name_;
638     return *this;
639 }
640 
641 // ******************************************************************************************
642 // *
643 // *	GetUserName
644 // *
645 // ******************************************************************************************
646 //!
647 //!		@return		this player's name, cleared for system logs. Use for writing to files or comparing with admin input.
648 //!
649 // ******************************************************************************************
650 
GetUserName(void)651 tString const & ePlayerNetID::GetUserName( void ) const
652 {
653     return this->userName_;
654 }
655 
656 // ******************************************************************************************
657 // *
658 // *	GetUserName
659 // *
660 // ******************************************************************************************
661 //!
662 //!		@param	userName	this player's name, cleared for system logs. Use for writing to files or comparing with admin input. to fill
663 //!		@return		A reference to this to allow chaining
664 //!
665 // ******************************************************************************************
666 
GetUserName(tString & userName)667 ePlayerNetID const & ePlayerNetID::GetUserName( tString & userName ) const
668 {
669     userName = this->userName_;
670     return *this;
671 }
672 
673 // ******************************************************************************************
674 // *
675 // *	SetUserName
676 // *
677 // ******************************************************************************************
678 //!
679 //!		@param	userName	this player's name, cleared for system logs. Use for writing to files or comparing with admin input. to set
680 //!		@return		A reference to this to allow chaining
681 //!
682 // ******************************************************************************************
683 
SetUserName(tString const & userName)684 ePlayerNetID & ePlayerNetID::SetUserName( tString const & userName )
685 {
686     this->userName_ = userName;
687     return *this;
688 }
689 
690 #endif
691 
692