From a4245d171859211aa867d67d4592b0211a6c943b Mon Sep 17 00:00:00 2001 From: Rick Bird Date: Tue, 12 Apr 2011 20:17:30 -0400 Subject: [PATCH] Clean up of @newpass code and bcreate power check. --- hdrs/mushdb.h | 2 +- src/division.c | 2 +- src/wiz.c | 9 +-------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/hdrs/mushdb.h b/hdrs/mushdb.h index ab49741..1f28902 100644 --- a/hdrs/mushdb.h +++ b/hdrs/mushdb.h @@ -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)) diff --git a/src/division.c b/src/division.c index 5acb970..8c6c736 100644 --- a/src/division.c +++ b/src/division.c @@ -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)); } diff --git a/src/wiz.c b/src/wiz.c index 863d868..23853c5 100644 --- 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.")); -- 2.30.2