Permalink
Browse files

directly pass the slot number to OpenItemWindow where possible

This prevents problems with "ItemButton" changing in between due to
window focus changes.
  • Loading branch information...
1 parent 1cea90e commit 596bcde85950cd7ece2eb09782b3bcf57e00afd7 @fizzet fizzet committed Apr 16, 2013
Showing with 11 additions and 6 deletions.
  1. +11 −6 gemrb/GUIScripts/InventoryCommon.py
@@ -358,13 +358,18 @@ def DisplayItem (itemresref, type):
ItemInfoWindow.ShowModal(MODAL_SHADOW_GRAY)
return
-def OpenItemInfoWindow ():
+def OpenItemInfoWindow (slot = None):
pc = GemRB.GameGetSelectedPCSingle ()
- if GUICommon.GameIsPST():
- slot, slot_item = GUIINV.ItemHash[GemRB.GetVar ('ItemButton')]
+
+ if slot == None:
+ if GUICommon.GameIsPST():
+ slot, slot_item = GUIINV.ItemHash[GemRB.GetVar ('ItemButton')]
+ else:
+ slot = GemRB.GetVar ("ItemButton")
+ slot_item = GemRB.GetSlotItem (pc, slot)
else:
- slot = GemRB.GetVar ("ItemButton")
slot_item = GemRB.GetSlotItem (pc, slot)
+
item = GemRB.GetItem (slot_item["ItemResRef"])
if TryAutoIdentification(pc, item, slot, slot_item, True):
@@ -790,7 +795,7 @@ def IdentifyUseSpell ():
ItemInfoWindow.Unload ()
GemRB.ChangeItemFlag (pc, slot, IE_INV_ITEM_IDENTIFIED, OP_OR)
GemRB.PlaySound(DEF_IDENTIFY)
- OpenItemInfoWindow()
+ OpenItemInfoWindow(slot)
return
def IdentifyUseScroll ():
@@ -807,7 +812,7 @@ def IdentifyUseScroll ():
if GemRB.HasSpecialItem (pc, 1, 1):
GemRB.ChangeItemFlag (pc, slot, IE_INV_ITEM_IDENTIFIED, OP_OR)
GemRB.PlaySound(DEF_IDENTIFY)
- OpenItemInfoWindow()
+ OpenItemInfoWindow(slot)
return
def CloseIdentifyItemWindow ():

0 comments on commit 596bcde

Please sign in to comment.