memset(name, 0, 255);
memset(password, 0, 255);
- cout << "Got Here" << endl;
-
exp = 1;
gold = 0;
bank = 500;
weapon = 1;
level = 1;
alive = 1;
- started = 1; // Possibly deprecated
forest_fights = 100;
player_fights = 3;
fight = NULL;
master = NULL;
battle = NULL;
+ flags = 0;
}
Player::Player(aClient *user)
password = new char[256];
if (user)
+ {
setData(user->stats);
+ strcpy(name, user->getNick());
+ }
else
setData(NULL);
weapon = right->weapon;
level = right->level;
alive = right->alive;
- started = right->started; // Possibly obsoleted
forest_fights = right->forest_fights;
player_fights = right->player_fights;
+ flags = right->flags;
}
else
{
reset();
int num = rand() % 32767;
- sprintf(name, "Player%d\0", num);
+ sprintf(name, "Player%d", num);
}
cout << "Setting Player data for " << name << endl;
}
+
+monster_::~monster_()
+{
+ delete name;
+ delete weapon;
+ delete death;
+}
+
+monster_::monster_()
+{
+ name = new char[32];
+ weapon = new char[32];
+ death = new char[256];
+
+ memset(name, 0, 32);
+ memset(weapon, 0, 32);
+ memset(death, 0, 256);
+}
+
+monster_::monster_(monster_ *m)
+{
+ name = new char[strlen(m->name) + 1];
+ weapon = new char[strlen(m->weapon) + 1];
+ death = new char[strlen(m->death) + 1];
+
+ strcpy(name, m->name);
+ strcpy(weapon, m->weapon);
+ strcpy(death, m->death);
+
+ strength = m->strength;
+ maxhp = m->maxhp;
+ hp = m->hp;
+ gold = m->gold;
+ exp = m->exp;
+}
+
+long int Player::setFlags(long int newflags)
+{
+ flags = newflags;
+ return getFlags();
+}
+
+long int Player::addFlag(long int flag)
+{
+ flags |= flag;
+ return getFlags();
+}
+
+long int Player::remFlag(long int flag)
+{
+ flags &= ~flag;
+ return getFlags();
+}
+