- #ifdef DEBUGMODE
- char *output;
- output = new char[strlen(name) + strlen(password) + 48];
- strcpy(output, "Deleting Player");
- #endif
-
- if (name != NULL)
- {
- #ifdef DEBUGMODE
- sprintf(output, "%s: %s", output, name);
- #endif
-
- delete [] name;
- }
-
- if (password != NULL)
- {
- #ifdef DEBUGMODE
- sprintf(output, "%s Password: %s", output, password);
- #endif
-
- delete [] password;
- }
-
- #ifdef DEBUGMODE
- log ("%s", output);
- delete [] output;
- #endif
+ 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);