User.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. ////////////////////////////////////////////////////////////////////////////////
  24. // User class copy and comparisons
  25. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  26. #include "GameNetwork/User.h"
  27. /**
  28. * Constructor. Sets up the member variables with the appropriate values.
  29. */
  30. User::User(UnicodeString name, UnsignedInt addr, UnsignedInt port) {
  31. m_name.set(name);
  32. m_ipaddr = addr;
  33. m_port = port;
  34. }
  35. /**
  36. * The assignment operator.
  37. */
  38. User & User::operator= (const User *other)
  39. {
  40. m_name = other->m_name;
  41. m_ipaddr = other->m_ipaddr;
  42. m_port = other->m_port;
  43. return *this;
  44. }
  45. /**
  46. * The equality operator.
  47. */
  48. Bool User::operator== (const User *other)
  49. {
  50. return (m_name.compare(other->m_name) == 0);
  51. }
  52. /**
  53. * The inequality operator.
  54. */
  55. Bool User::operator!= (const User *other)
  56. {
  57. return (m_name.compare(other->m_name) != 0);
  58. }
  59. /**
  60. * Set the name of this user.
  61. */
  62. void User::setName(UnicodeString name) {
  63. m_name.set(name);
  64. }