From f69313f95040bd0bfa0e97c57aa12c2cd1088a06 Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Tue, 22 May 2007 15:41:28 +0000 Subject: [PATCH] Clear up handling of 'me' and 'here'. --- functions_db.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/functions_db.py b/functions_db.py index 1e0dab2b2c..b84e200b10 100644 --- a/functions_db.py +++ b/functions_db.py @@ -142,7 +142,14 @@ def local_and_global_search(searcher, ostring, search_contents=True, search_loca dbref_match = list(dbref_results) if len(dbref_match) > 0: return dbref_match - + + # If the search string is one of the following, return immediately with + # the appropriate result. + if searcher.get_location().dbref_match(ostring) or ostring == 'here': + return [searcher.get_location()] + elif ostring == 'me' and searcher: + return [searcher] + local_matches = [] # Handle our location/contents searches. list_search_object_namestr() does # name and dbref comparisons against search_query. @@ -151,12 +158,6 @@ def local_and_global_search(searcher, ostring, search_contents=True, search_loca if search_location: local_matches += list_search_object_namestr(searcher.get_location().get_contents(), search_query, limit_types=limit_types) - # If the object the invoker is in matches, add it as well. - if searcher.get_location().dbref_match(ostring) or ostring == 'here': - local_matches.append(searcher.get_location()) - elif ostring == 'me' and searcher: - local_matches.append(searcher) - return local_matches def is_dbref(dbstring):