Ensure items were removed.

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@14501 282e977c-c81d-0410-88c4-b93c2d0d6712
master
ryo_saeba 2011-05-29 18:28:07 +00:00
parent 955102cc66
commit 0737416c01
1 changed files with 4 additions and 2 deletions

View File

@ -30,9 +30,11 @@ else:
inv = character.CheckInventory(itemname)
if inv:
if quantity == 0:
CFItemBroker.Item(inv).subtract(inv.Quantity)
inv.Remove()
else:
CFItemBroker.Item(inv).subtract(int(quantity))
status = CFItemBroker.Item(inv).subtract(int(quantity))
if status == 0:
Crossfire.Log(Crossfire.LogError, "Dialog script tried to remove more items than available from player %s" %(character.Name))
# we might have been wearing an item that was taken.
character.Fix()
else: