Updated Duping

From: George (greerga@CIRCLEMUD.ORG)
Date: 01/16/98


With this patch, the first place I can successfully log in with the other
character's name is during the MOTD.  Of course, the original is killed
during the duplicate check.  Try this out.

diff -uprN -x *.o j13stk/ban.c nodupe/ban.c
--- j13stk/ban.c        Sun Jan  4 21:38:40 1998
+++ nodupe/ban.c        Fri Jan 16 13:55:43 1998
@@ -20,7 +20,7 @@
 #include "db.h"

 struct ban_list_element *ban_list = NULL;
-
+extern struct descriptor_data *descriptor_list;

 char *ban_types[] = {
   "no",
@@ -240,8 +240,17 @@ int num_invalid = 0;
 int Valid_Name(char *newname)
 {
   int i;
-
+  struct descriptor_data *dt;
   char tempname[MAX_INPUT_LENGTH];
+
+  /*
+   * Make sure someone isn't trying to create this same name.  We want to
+   * do a 'str_cmp' so people can't do 'Bob' and 'BoB'.  The creating login
+   * will not have a character name yet.
+   */
+  for (dt = descriptor_list; dt; dt = dt->next)
+    if (GET_NAME(dt->character) && !str_cmp(GET_NAME(dt->character), newname))
+      return (STATE(dt) == CON_PLAYING); /* If playing, allow reconnecting. */

   /* return valid if list doesn't exist */
   if (!invalid_list || num_invalid < 1)
diff -uprN -x *.o j13stk/interpreter.c nodupe/interpreter.c
--- j13stk/interpreter.c        Sun Jan  4 20:29:59 1998
+++ nodupe/interpreter.c        Fri Jan 16 14:09:36 1998
@@ -1299,6 +1299,14 @@ void nanny(struct descriptor_data *d, ch
        GET_PFILEPOS(d->character) = player_i;

        if (PLR_FLAGGED(d->character, PLR_DELETED)) {
+         /* We get false positive from the original deleted name. */
+         free(GET_NAME(d->character));
+         GET_NAME(d->character) = NULL;
+         /* Check for multiple creations... */
+         if (!Valid_Name(tmp_name)) {
+           SEND_TO_Q("Invalid name, please try another.\r\nName: ", d);
+           return;
+         }
          free_char(d->character);
          CREATE(d->character, struct char_data, 1);
          clear_char(d->character);
@@ -1323,9 +1331,9 @@ void nanny(struct descriptor_data *d, ch
       } else {
        /* player unknown -- make new character */

+       /* Check for multiple creations of a character. */
        if (!Valid_Name(tmp_name)) {
-         SEND_TO_Q("Invalid name, please try another.\r\n", d);
-         SEND_TO_Q("Name: ", d);
+         SEND_TO_Q("Invalid name, please try another.\r\nName: ", d);
          return;
        }
        CREATE(d->character->player.name, char, strlen(tmp_name) + 1);


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST