]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/player.cpp
Added everything necessary to save overtop of the old dragon when someone beats the...
[irc/gameservirc.git] / gameserv / player.cpp
index e8b0fd7786e188bd1a9806ffaa46626b672056ab..372ebe1fbb726ca903065c27fbc6cde467ba5d25 100644 (file)
@@ -3,6 +3,7 @@
 #include "extern.h"
 #include "flags.h"
 #include <string>
+#include <stdio.h>
 
 using namespace std;
 
@@ -88,6 +89,18 @@ Player::~Player()
        delete output;
     #endif
 }
+void Player::setPassword(const char *p)
+{
+      static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV\
+WXYZ0123456789./";
+      static char salt[3];
+
+      salt[0] = saltChars[rand() % strlen(saltChars)];
+      salt[1] = saltChars[rand() % strlen(saltChars)];
+      salt[2] = '\0';
+
+      password = crypt(p, salt);
+}
 
 void Player::setData(Player *right)
 {
@@ -140,6 +153,7 @@ monster_::monster_()
     weapon.erase();
     death.erase();
     strength = 0;
+    defense = 0;
     exp = 0;
     gold = 0;
     maxhp = hp = 0;
@@ -151,6 +165,7 @@ monster_::monster_(monster_ *m)
     weapon = m->weapon;
     death = m->death;
     strength = m->strength;
+    defense = m->defense;
     maxhp = m->maxhp;
     hp = m->hp;
     gold = m->gold;
@@ -163,6 +178,7 @@ monster_::monster_(monster_ &m)
     weapon = m.weapon;
     death = m.death;
     strength = m.strength;
+    defense = m.defense;
     maxhp = m.maxhp;
     hp = m.hp;
     gold = m.gold;