Fixed an issue with "Fuzzy" pattern matching that would not find names at certain times.

For example, before the fix, you could face the following issue: Create a bunch of boxes with @create:
box, box1, box2, box3 ... Now try to examine 'box'. This would not work - the game would tell you that there
were multiple matches - it just found "box" in all entries and went with that. So despite there only being one
thing named solely "box", you could not target it! This fix resolves this by giving precedence to exact matches
whenever they exist. I have only done it for the support routine behind local_and_global_search() though, there
are other search functions that uses django directly for fuzzy __in searches. I don't know how to add a similar
functionality to them.
/Griatch
This commit is contained in:
Griatch 2009-08-30 20:18:56 +00:00
parent c5c8505582
commit 68217072a6
4 changed files with 50 additions and 19 deletions

View file

@ -8,6 +8,7 @@ from src.channels.models import CommChannelMembership, CommChannel
from src import defines_global
from src import ansi
from src.util import functions_general
from src.objects.models import Object
from src.cmdtable import GLOBAL_CMD_TABLE
#from src.imc2.models import IMC2ChannelMapping
#from src.imc2.packets import IMC2PacketIceMsgBroadcasted
@ -324,7 +325,7 @@ def cmd_cboot(command):
if objname[0] == '*':
player_boot = True
objname = objname[1:]
bootobj = source_object.search_for_object(objname)
bootobj = Object.objects.player_name_search(objname)
if not bootobj:
source_object.emit_to("Object '%s' not found." % objname)
return
@ -517,7 +518,7 @@ def cmd_cchown(command):
source_object.emit_to("You don't control this channel.")
return
#find the new owner
new_owner = source_object.search_for_object(pname)
new_owner = Object.objects.player_name_search(pname)
if not new_owner:
source_object.emit_to("New owner '%s' not found." % pname)
return