From e55ebefbe02b6443d6aaeecacd606a9280d26edc Mon Sep 17 00:00:00 2001 From: Rick L Bird Date: Thu, 5 May 2011 18:12:07 -0400 Subject: [PATCH] PennMUSH 1.8.3p11 Author: captdeaf@gmail.com Date: Mon Oct 26 16:05:34 2009 +0000 Added testlock(, ) Fixes #137 --- src/function.c | 1 + src/fundb.c | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/function.c b/src/function.c index 26939ec..cc16877 100644 --- a/src/function.c +++ b/src/function.c @@ -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}, diff --git a/src/fundb.c b/src/fundb.c index 5d83b51..6e126ca 100644 --- a/src/fundb.c +++ b/src/fundb.c @@ -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) -- 2.30.2