Bad logic for object recycling. Boo me. Adjusted create_object() and @nextfree.
This commit is contained in:
parent
74a3a01429
commit
3ae3bd6884
2 changed files with 5 additions and 13 deletions
|
|
@ -292,12 +292,7 @@ def cmd_nextfree(cdat):
|
||||||
session = cdat['session']
|
session = cdat['session']
|
||||||
|
|
||||||
nextfree = functions_db.get_nextfree_dbnum()
|
nextfree = functions_db.get_nextfree_dbnum()
|
||||||
if str(nextfree).isdigit():
|
session.msg("Next free object number: #%s" % (nextfree,))
|
||||||
retval = "Next free object number: #%s" % (nextfree,)
|
|
||||||
else:
|
|
||||||
retval = "Next free object number: #%s (GARBAGE)" % (nextfree.id,)
|
|
||||||
|
|
||||||
session.msg(retval)
|
|
||||||
|
|
||||||
def cmd_open(cdat):
|
def cmd_open(cdat):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ def get_nextfree_dbnum():
|
||||||
nextfree = Object.objects.filter(type__exact=defines_global.OTYPE_GARBAGE)
|
nextfree = Object.objects.filter(type__exact=defines_global.OTYPE_GARBAGE)
|
||||||
if nextfree:
|
if nextfree:
|
||||||
# We've got at least one garbage object to recycle.
|
# We've got at least one garbage object to recycle.
|
||||||
return nextfree[0]
|
return nextfree.id
|
||||||
else:
|
else:
|
||||||
# No garbage to recycle, find the highest dbnum and increment it
|
# No garbage to recycle, find the highest dbnum and increment it
|
||||||
# for our next free.
|
# for our next free.
|
||||||
|
|
@ -263,12 +263,9 @@ def create_object(odat):
|
||||||
location key for home.
|
location key for home.
|
||||||
"""
|
"""
|
||||||
next_dbref = get_nextfree_dbnum()
|
next_dbref = get_nextfree_dbnum()
|
||||||
if not str(next_dbref).isdigit():
|
|
||||||
# Recycle a garbage object.
|
|
||||||
new_object = next_dbref
|
|
||||||
else:
|
|
||||||
new_object = Object()
|
new_object = Object()
|
||||||
|
|
||||||
|
new_object.id = next_dbref
|
||||||
new_object.type = odat["type"]
|
new_object.type = odat["type"]
|
||||||
new_object.set_name(odat["name"])
|
new_object.set_name(odat["name"])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue