From a488ff7541e4b00af8a78de51b7bb01a8f05fb2a Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Fri, 13 Apr 2007 03:50:40 +0000 Subject: [PATCH] locate() can take more than one type and prefer all of them (cherry picked from commit 42ea0853eb2f3d4b491380f644169212567ef7fc) --- game/txt/changes/0.73 | 1 + src/fundb.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/game/txt/changes/0.73 b/game/txt/changes/0.73 index b6795bf..7c50af5 100644 --- a/game/txt/changes/0.73 +++ b/game/txt/changes/0.73 @@ -194,4 +194,5 @@ CobraMUSH Version 0.73 * make distclean is now more thorough. [RLB] * FIXED flag restriction on 'home' is now entirely in restrict.cnf [AEJ] * @chan/list works better for people who increase CHAN_NAME_LEN [AEJ] + * locate() can take multiple types and prefer all of them [AEJ] diff --git a/src/fundb.c b/src/fundb.c index 35b1971..6212e3e 100644 --- a/src/fundb.c +++ b/src/fundb.c @@ -1666,26 +1666,26 @@ FUNCTION(fun_locate) } /* find out our preferred match type and flags */ - pref_type = NOTYPE; + pref_type = 0; for (p = args[2]; *p; p++) { switch (*p) { case 'N': - pref_type = NOTYPE; + pref_type |= NOTYPE; break; case 'E': - pref_type = TYPE_EXIT; + pref_type |= TYPE_EXIT; break; case 'P': - pref_type = TYPE_PLAYER; + pref_type |= TYPE_PLAYER; break; case 'R': - pref_type = TYPE_ROOM; + pref_type |= TYPE_ROOM; break; case 'T': - pref_type = TYPE_THING; + pref_type |= TYPE_THING; break; case 'D': - pref_type = TYPE_DIVISION; + pref_type |= TYPE_DIVISION; break; case 'L': keys = 1; @@ -1734,6 +1734,8 @@ FUNCTION(fun_locate) break; } } + if (!pref_type) + pref_type = NOTYPE; if (keys) match_flags = MAT_CHECK_KEYS; @@ -1749,7 +1751,7 @@ FUNCTION(fun_locate) return; } - if (force_type && pref_type != NOTYPE && !(Typeof(item) == pref_type)) { + if (force_type && !(Typeof(item) & pref_type)) { safe_dbref(NOTHING, buff, bp); return; } -- 2.30.2