]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/aClient.cpp
updated the Change log w/ new additions
[irc/gameservirc.git] / gameserv / aClient.cpp
index ceb149aa908ebec5c691369853b8da844a4b6317..8de6b3567170b0c262d149a3f562b91e4f7c938e 100644 (file)
@@ -10,9 +10,26 @@ aClient::aClient(char *n)
        log("aClient created: %s", (n[0] == '\0' ? "NULL" : n));
     #endif
     strcpy(nick, n);
+
+    #ifdef P10
+       strcpy(realnick, n);
+    #endif
+
     stats = NULL;
     flags = 0;
 }
+#ifdef P10
+aClient::aClient(char *n, char *rn)
+{
+    #ifdef DEBUGMODE
+       log("aClient created: %s", (n[0] == '\0' ? "NULL" : n));
+    #endif
+    strcpy(nick, n);
+    strcpy(realnick, rn);
+    stats = NULL;
+    flags = 0;
+}
+#endif
 
 aClient::aClient(const aClient &right)
 {
@@ -28,7 +45,6 @@ aClient::aClient(const aClient &right)
 aClient::aClient()
 {
     aClient("");
-    flags = 0;
 }
 
 aClient::~aClient()
@@ -36,7 +52,7 @@ aClient::~aClient()
     if (stats)
     {
        #ifdef DEBUGMODE
-           log("aClient deleted: %s %s %s", nick, stats->name, stats->password); 
+           log("aClient deleted: %s %s %s", nick, stats->getName().c_str(), stats->getPassword().c_str()); 
        #endif
 
        delete stats;
@@ -51,6 +67,23 @@ aClient::~aClient()
     flags = 0;
 }
 
+bool aClient::operator!=(const aClient &right)
+{
+  return !(*this == right);
+}
+
+bool aClient::operator==(const aClient &right)
+{
+  if (strcmp(nick, right.nick) == 0 && stats == right.stats)
+       {
+         return true;
+       }
+  else
+       {
+         return false;
+       }
+}
+
 ostream &operator<<( ostream &out, const aClient &c )
 {
     out << (c.nick[0] == '\0' ? "NULL" : c.nick);
@@ -59,19 +92,22 @@ ostream &operator<<( ostream &out, const aClient &c )
 
 void aClient::setData(const aClient *right)
 {
-    if (right != this)
+  if (right != this)
     {
-       strcpy(nick, right->nick);
-       if (right->stats)
-       {
-           if (!stats)
-               stats = new Player;
-           #ifdef DEBUGMODE
-               log("Should be setting data for %s", right->stats->name);
-           #endif
-
-           stats->setData(right->stats);
-       }
+         strcpy(nick, right->nick);
+#ifdef P10
+         strcpy(realnick, right->realnick);
+#endif
+         if (right->stats)
+               {
+                 if (!stats)
+                       stats = new Player;
+#ifdef DEBUGMODE
+                 log("Should be setting data for %s", right->stats->getName().c_str());
+#endif
+                 
+                 stats->setData(right->stats);
+               }
     }
 }