Clean up of @newpass code and bcreate power check.
authorRick Bird <nveid@bender.theari.com>
Wed, 13 Apr 2011 00:17:30 +0000 (20:17 -0400)
committerRick Bird <nveid@bender.theari.com>
Wed, 13 Apr 2011 00:17:30 +0000 (20:17 -0400)
hdrs/mushdb.h
src/division.c
src/wiz.c

index ab49741ec05016abf9b80e700cf1652b6b153328..1f2890211338d49b3f40a787dcddae82a0569971 100644 (file)
@@ -26,7 +26,7 @@
 #define Can_RPTEL(x)   OOREF(x,TC_RPTEL(x), TC_RPTEL(x))
 #define Can_BCREATE(x) (OOREF(x,div_powover(x,x, "BCreate"), div_powover(ooref, ooref, "BCreate")))
 #define See_All(x)       (God(x))
-#define CanNewpass(x,y)        OOREF(x,div_powover(x,y,"Newpass"), div_powover(ooref,y,"Newpass"))
+#define CanNewpass(x,y)        OOREF(x,div_powover(x,y,"Newpass"), div_powover(ooref,y,"Newpass")) || OOREF(x,div_powover(x,y,"BCreate"),div_powover(x,y,"BCreate"))
 /* #define CanSee(x,y)      (God(x) || div_powover(x,y,POW_SEE_ALL)) */
 #define Prived(x)        OOREF(x,div_powover(x,x,"Privilege"),div_powover(ooref,ooref,"Privilege"))
 #define Priv_Who(x)      (OOREF(x,div_powover(x,x,"PrivWho"),div_powover(ooref,ooref, "PrivWho")) || Site(x))
index 5acb9709b65a4f8e3d95fdbab33c361eb7aa022e..8c6c73676ab848cd7dc1e1403d33a963eb92a845 100644 (file)
@@ -1130,7 +1130,7 @@ powc_self(int plev __attribute__ ((__unused__)), dbref p1, dbref p2)
 int
 powc_bcreate(int plev __attribute__ ((__unused__)), dbref who, dbref what)
 {
-  if (!div_powover(who, who, "Builder"))
+  if (!has_power(what, "Builder")) 
     return 0;
   return (LEVEL(who) >= LEVEL(what));
 }
index 863d868dab7d6df924070189103cc85afb1ecefc..23853c56b6b3eb3ce1b9391051d6bd487bd7a40c 100644 (file)
--- a/src/wiz.c
+++ b/src/wiz.c
@@ -798,14 +798,7 @@ do_newpassword(dbref player, dbref cause,
       ((victim = match_result(player, name, TYPE_DIVISION, MAT_ABSOLUTE | MAT_NEIGHBOR | MAT_NEAR | MAT_ENGLISH)) == NOTHING || 
      Typeof(victim) != TYPE_DIVISION )) {
     notify(player, T("No such player or division."));
-  } else if(CanNewpass(player, victim)
-           || (Can_BCREATE(player) && (has_flag_by_name(victim, "BUILDER",
-                                                        TYPE_PLAYER))
-               && (LEVEL(player) >= LEVEL(victim)))) {
-    if(Typeof(victim) != TYPE_DIVISION && Typeof(victim) != TYPE_PLAYER) {
-       notify(player, "Wtf happened?");
-          return;
-    }
+  } else if(CanNewpass(player, victim)) {
     if (*password != '\0' && !ok_password(password)) {
       /* Wiz can set null passwords, but not bad passwords */
       notify(player, T("Bad password."));