PennMUSH 1.8.3p11
authorRick L Bird <nveid@yahoo.com>
Thu, 5 May 2011 22:12:07 +0000 (18:12 -0400)
committerRick L Bird <nveid@yahoo.com>
Thu, 5 May 2011 22:12:07 +0000 (18:12 -0400)
Author: captdeaf@gmail.com
<captdeaf@gmail.com@ba372814-4f39-11de-9ad6-1127a62b9fcd>
Date:   Mon Oct 26 16:05:34 2009 +0000

    Added testlock(<lock>, <victim>)

Fixes #137

src/function.c
src/fundb.c

index 26939ecec1a6e71fe094dfe151150889948398bd..cc168774cbb856948533390436fea4db559d9a54 100644 (file)
@@ -716,6 +716,7 @@ FUNTAB flist[] = {
   {"TABLE", fun_table, 1, 5, FN_REG},
   {"TEL", fun_tel, 2, 4, FN_REG},
   {"TERMINFO", fun_terminfo, 1, 1, FN_REG},
+  {"TESTLOCK", fun_testlock, 2, 2, FN_REG},
   {"TEXTENTRIES", fun_textentries, 2, 3, FN_REG},
   {"TEXTFILE", fun_textfile, 2, 2, FN_REG},
   {"TIME", fun_time, 0, 1, FN_REG},
index 5d83b51b06ac955521187358ab2c8bd4f4003875..6e126ca79e10908b4221694311f96b2ed8073c12 100644 (file)
@@ -37,10 +37,9 @@ extern struct db_stat_info *get_stats(dbref owner);
 static int lattr_helper(dbref player, dbref thing, dbref parent, char const *pattern,
                         ATTR *atr, void *args);
 
-static dbref
-dbwalk(char *buff, char **bp, dbref executor, dbref enactor,
-       int type, dbref loc, dbref after, int skipdark,
-       int start, int count, int *retcount);
+static dbref dbwalk(char *buff, char **bp, dbref executor, dbref enactor,
+                    int type, dbref loc, dbref after, int skipdark,
+                    int start, int count, int *retcount);
 
 const char *
 do_get_attrib(dbref executor, dbref thing, const char *attrib)
@@ -1306,6 +1305,26 @@ FUNCTION(fun_elock)
     safe_str("#-1", buff, bp);
   return;
 }
+/* ARGSUSED */
+FUNCTION(fun_testlock)
+{
+  dbref victim = match_thing(executor, args[1]);
+  boolexp elock = TRUE_BOOLEXP;
+
+  elock = parse_boolexp(executor, args[0], "Search");
+
+  if (!GoodObject(victim)) {
+    safe_str("#-1", buff, bp);
+    return;
+  }
+  if (Can_Locate(executor, victim)) {
+    safe_boolean(eval_boolexp(victim, elock, executor, NULL), buff, bp);
+  } else {
+    safe_str("#-1", buff, bp);
+  }
+  free_boolexp(elock);
+  return;
+}
 
 /* ARGSUSED */
 FUNCTION(fun_findable)