Allow players to change to forbidden names they already use
authorAri Johnson <ari@theari.com>
Mon, 29 Sep 2008 15:40:13 +0000 (15:40 +0000)
committerAri Johnson <ari@theari.com>
Mon, 29 Sep 2008 15:40:13 +0000 (15:40 +0000)
src/predicat.c

index 87e43013a23d93df92ce1d6e0489499efa4ac98e..3141b9136699d7ae563ebc5fdab9852b87956060 100644 (file)
@@ -803,9 +803,7 @@ ok_player_name(const char *name, dbref player, dbref thing)
   const unsigned char *scan, *good;
   dbref lookup;
 
-  if (!ok_name(name)
-      || (forbidden_name(name) && !(GoodObject(player) && Director(player)))
-      || strlen(name) >= (size_t) PLAYER_NAME_LIMIT)
+  if (!ok_name(name) || strlen(name) >= (size_t) PLAYER_NAME_LIMIT)
     return 0;
 
   good = (unsigned char *) (PLAYER_NAME_SPACES ? " `$_-.,'" : "`$_-.,'");
@@ -819,6 +817,13 @@ ok_player_name(const char *name, dbref player, dbref thing)
   }
 
   lookup = lookup_player(name);
+
+  /* A player may only change to a forbidden name if they're already
+     using that name. */
+  if (forbidden_name(name) && !((lookup == thing) ||
+                               (GoodObject(player) && Director(player))))
+    return 0;
+
   return ((lookup == NOTHING) || (lookup == thing));
 }