]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/aClient.cpp
P10 is now functional. The game is playable, but it does not display text nicknames...
[irc/gameservirc.git] / gameserv / aClient.cpp
index f7fc5d86049a9d2c3864e671e78e80caedf06cc2..ceb149aa908ebec5c691369853b8da844a4b6317 100644 (file)
@@ -1,37 +1,54 @@
 #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);
     stats = NULL;
+    flags = 0;
 }
 
 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);
 }
 
 aClient::aClient()
 {
     aClient("");
+    flags = 0;
 }
 
 aClient::~aClient()
 {
-    cout << "aClient deleted: " << *this;
     if (stats)
     {
-       cout << ' ' << stats->name;
+       #ifdef DEBUGMODE
+           log("aClient deleted: %s %s %s", nick, stats->name, stats->password); 
+       #endif
+
        delete stats;
     }
-    cout << endl;
+  #ifdef DEBUGMODE
+    else
+    {
+       log("aClient deleted: %s", nick);
+    }
+  #endif
+
+    flags = 0;
 }
 
 ostream &operator<<( ostream &out, const aClient &c )
@@ -49,9 +66,29 @@ void aClient::setData(const aClient *right)
        {
            if (!stats)
                stats = new Player;
+           #ifdef DEBUGMODE
+               log("Should be setting data for %s", right->stats->name);
+           #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();
+}