]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/aClient.cpp
added items to the tavern.dat, added the filename option to the config file
[irc/gameservirc.git] / gameserv / aClient.cpp
index e95c33243f620b13280d7757a7b75173e6c93ae5..de5459547ec9a01f1260f9462156eb3b86b93a41 100644 (file)
@@ -1,20 +1,44 @@
 #include "aClient.h"
+#include "options.h"
+#include "extern.h"
 #include <stdlib.h>
 #include <stdio.h>
 
 aClient::aClient(char *n)
 {
-    cout << "aClient created: " 
-        << (n[0] == '\0' ? "NULL" : n) << endl;
+    #ifdef DEBUGMODE
+       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)
 {
-    cout << "aClient created from another aClient: " << right.nick 
-        << endl;
+    #ifdef DEBUGMODE
+       log("aClient created from another aClient: %s\n", right.nick);
+    #endif
+
     stats = NULL;
+    flags = 0;
     setData(&right);
 }
 
@@ -25,13 +49,22 @@ aClient::aClient()
 
 aClient::~aClient()
 {
-    cout << "aClient deleted: " << *this << flush;
     if (stats)
     {
-       cout << ' ' << stats->name << ' ' << stats->password << endl << flush;
+       #ifdef DEBUGMODE
+           log("aClient deleted: %s %s %s", nick, stats->name.c_str(), stats->password.c_str()); 
+       #endif
+
        delete stats;
     }
-    cout << endl << flush;
+  #ifdef DEBUGMODE
+    else
+    {
+       log("aClient deleted: %s", nick);
+    }
+  #endif
+
+    flags = 0;
 }
 
 ostream &operator<<( ostream &out, const aClient &c )
@@ -45,13 +78,36 @@ void aClient::setData(const aClient *right)
     if (right != this)
     {
        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->name.c_str());
+           #endif
 
-           cout << "Should be setting data for " << right->stats->name << endl;
            stats->setData(right->stats);
        }
     }
 }
+
+long int aClient::setFlags(long int newflags)
+{
+    flags = newflags;
+    return getFlags();
+}
+
+long int aClient::addFlag(long int flag)
+{
+    flags |= flag;
+    return getFlags();
+}
+
+long int aClient::remFlag(long int flag)
+{
+    flags &= ~flag;
+    return getFlags();
+}