-{
- cout << "Deleting player";
-
- if (name)
- {
- cout << ": " << name;
- delete [] name;
- }
- if (password)
- {
- cout << " Password: " << password;
- delete [] password;
- }
- cout << endl << "Player Deleted";
+{
+ delete inventory;
+
+#ifdef DEBUGMODE
+ string *output;
+ output = new string("Deleting Player");
+#endif
+
+#ifdef DEBUGMODE
+ *output += ": " + name;
+#endif
+
+#ifdef DEBUGMODE
+ *output += " Password: " + password;
+ log ("%s", output->c_str());
+ 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);