Better error messages for invalid function restrictions
authorAri Johnson <ari@cobramush.org>
Sat, 3 Mar 2007 00:38:25 +0000 (00:38 +0000)
committerAri Johnson <ari@theari.com>
Thu, 24 Mar 2011 15:58:45 +0000 (15:58 +0000)
(cherry picked from commit ce304b0513fa51611a20ca1edf8996bdfb9e3f1b)

src/function.c

index ce234c67f8d1aa62e8a98f2badbb102619a2cb56..7096712c4f12c4f325683e0f0deb4bc917bc20ec 100644 (file)
@@ -1089,8 +1089,15 @@ do_function_restrict(dbref player, const char *name, const char *restriction)
     notify(player, T("Do what with the function?"));
     return;
   }
-  if (restrict_function(name, restriction))
-    notify(player, T("Restrictions modified."));
+  fp = func_hash_lookup(name);
+  if (!fp) {
+    notify(player, T("No such function."));
+    return;
+  }
+  flags = fp->flags;
+  fp->flags = apply_restrictions(flags, restriction);
+  if (fp->flags == flags)
+    notify(player, T("Restrictions unchanged."));
   else
     notify(player, T("Restrictions modified."));
 }