Fixed issues with batch-code processor not working correctly. Also added some better parsing. Resolves issue 221.

This commit is contained in:
Griatch 2012-03-20 22:29:37 +01:00
parent 81e7a31072
commit 1ca8df9e70
5 changed files with 39 additions and 36 deletions

View file

@ -191,7 +191,7 @@ class ObjectManager(TypedObjectManager):
If None, the default 'key' attribute is used.
location: If None, character.location will be used.
"""
#ostring = str(ostring).strip()
ostring = to_unicode(ostring, force_string=True)
if not ostring:
return []
@ -210,16 +210,16 @@ class ObjectManager(TypedObjectManager):
if location and ostring == 'here':
return [location]
if caller and to_unicode(ostring) in ('me', 'self'):
if caller and ostring in ('me', 'self'):
return [caller]
if caller and to_unicode(ostring) in ('*me', '*self'):
if caller and ostring in ('*me', '*self'):
return [caller]
# Test if we are looking for an object controlled by a
# specific player
#logger.log_infomsg(str(type(ostring)))
if to_unicode(ostring).startswith("*"):
if ostring.startswith("*"):
# Player search - try to find obj by its player's name
player_match = self.get_object_with_player(ostring)
if player_match is not None:

View file

@ -31,16 +31,20 @@ class Object(TypeClass):
def __eq__(self, other):
"""
Checks for equality against an id string or another object or user.
This has be located at this level, having it in the
parent doesn't work.
"""
result = other and other.id == self.id
try:
uresult = other and (other.user.id == self.user.id)
except AttributeError:
uresult = False
return result or uresult
result = self.id == other
if not result and hasattr(other, "id"):
result = self.id == other.id
if not result:
try:
result = other and self.user.id == other.user.id
except AttributeError:
pass
return result
# hooks called by the game engine