X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/96f71fee914dfe6be488b27f2f66a59cf3d901ff..6f727d4c9eb5c886f14598577f40da583577444e:/gameserv/aClient.cpp diff --git a/gameserv/aClient.cpp b/gameserv/aClient.cpp index 64884d3..2ca249a 100644 --- a/gameserv/aClient.cpp +++ b/gameserv/aClient.cpp @@ -1,20 +1,42 @@ #include "aClient.h" +#include "options.h" +#include "extern.h" #include #include 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); @@ -23,19 +45,26 @@ aClient::aClient(const aClient &right) aClient::aClient() { aClient(""); - flags = 0; } 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, stats->password); + #endif + delete stats; } + #ifdef DEBUGMODE + else + { + log("aClient deleted: %s", nick); + } + #endif + flags = 0; - cout << endl << flush; } ostream &operator<<( ostream &out, const aClient &c ) @@ -49,12 +78,17 @@ 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); + #endif - cout << "Should be setting data for " << right->stats->name << endl; stats->setData(right->stats); } }