LANPlayer.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // LANPlayer.h ///////////////////////////////////////////////////////////////
  24. // LAN Player Class used for both the LANAPI and LANGameInfo
  25. // Author: Matthew D. Campbell, October 2001 (Pulled out of LANAPI.h by CLH on 12/21/01
  26. #pragma once
  27. #ifndef _LANPLAYER_H_
  28. #define _LANPLAYER_H_
  29. /**
  30. * LAN player class. This is for players sitting in the lobby. Players are
  31. * uniquely identified by their IP addresses.
  32. */
  33. class LANPlayer
  34. {
  35. public:
  36. LANPlayer() { m_name = m_login = m_host = L""; m_lastHeard = 0; m_next = NULL; m_IP = 0; }
  37. // Access functions
  38. inline UnicodeString getName( void ) { return m_name; }
  39. inline void setName( UnicodeString name ) { m_name = name; }
  40. inline UnicodeString getLogin( void ) { return m_login; }
  41. inline void setLogin( UnicodeString name ) { m_login = name; }
  42. inline void setLogin( AsciiString name ) { m_login.translate(name); }
  43. inline UnicodeString getHost( void ) { return m_host; }
  44. inline void setHost( UnicodeString name ) { m_host = name; }
  45. inline void setHost( AsciiString name ) { m_host.translate(name); }
  46. inline UnsignedInt getLastHeard( void ) { return m_lastHeard; }
  47. inline void setLastHeard( UnsignedInt lastHeard ) { m_lastHeard = lastHeard; }
  48. inline LANPlayer *getNext( void ) { return m_next; }
  49. inline void setNext( LANPlayer *next ) { m_next = next; }
  50. inline UnsignedInt getIP( void ) { return m_IP; }
  51. inline void setIP( UnsignedInt IP ) { m_IP = IP; }
  52. protected:
  53. UnicodeString m_name; ///< Player name
  54. UnicodeString m_login; ///< login name
  55. UnicodeString m_host; ///< machine name
  56. UnsignedInt m_lastHeard; ///< The last time we heard from this player (for timeout purposes)
  57. LANPlayer *m_next; ///< Linked list pointer
  58. UnsignedInt m_IP; ///< Player's IP
  59. };
  60. #endif //_LANPLAYER_H_