]> jfr.im git - irc/gameservirc.git/blame_incremental - gameserv/aClient.cpp
do_identify is now fixed (i hope). All previous do_identify commits were buggy and...
[irc/gameservirc.git] / gameserv / aClient.cpp
... / ...
CommitLineData
1#include "aClient.h"
2#include <stdlib.h>
3#include <stdio.h>
4
5aClient::aClient(char *n)
6{
7 cout << "aClient created: "
8 << (n[0] == '\0' ? "NULL" : n) << endl;
9 strcpy(nick, n);
10 stats = NULL;
11}
12
13aClient::aClient(const aClient &right)
14{
15 cout << "aClient created from another aClient: " << right.nick
16 << endl;
17 stats = NULL;
18 setData(&right);
19}
20
21aClient::aClient()
22{
23 aClient("");
24}
25
26aClient::~aClient()
27{
28 cout << "aClient deleted: " << *this << flush;
29 if (stats)
30 {
31 cout << ' ' << stats->name << ' ' << stats->password << endl << flush;
32 delete stats;
33 }
34 cout << endl << flush;
35}
36
37ostream &operator<<( ostream &out, const aClient &c )
38{
39 out << (c.nick[0] == '\0' ? "NULL" : c.nick);
40 return out;
41}
42
43void aClient::setData(const aClient *right)
44{
45 if (right != this)
46 {
47 strcpy(nick, right->nick);
48 if (right->stats)
49 {
50 if (!stats)
51 stats = new Player;
52
53 cout << "Should be setting data for " << right->stats->name << endl;
54 stats->setData(right->stats);
55 }
56 }
57}