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 ? " `$_-.,'" : "`$_-.,'");
}
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));
}