From 5874a17c707a2151c1042de14513a0f4f13b2457 Mon Sep 17 00:00:00 2001 From: Jaka Kranjc Date: Tue, 29 Jun 2010 13:24:05 +0200 Subject: [PATCH] iwd: more gcw syncing with bg2 - actonpc and dragging --- gemrb/GUIScripts/iwd/GUICommonWindows.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gemrb/GUIScripts/iwd/GUICommonWindows.py b/gemrb/GUIScripts/iwd/GUICommonWindows.py index 37f296253..84ccf9a46 100644 --- a/gemrb/GUIScripts/iwd/GUICommonWindows.py +++ b/gemrb/GUIScripts/iwd/GUICommonWindows.py @@ -634,6 +634,13 @@ def PortraitButtonOnDrag (): def PortraitButtonOnPress (): i = GemRB.GetVar ("PressedPortrait") + if not i: + return + + if GemRB.GameControlGetTargetMode() != TARGET_MODE_NONE: + GemRB.ActOnPC (i) + return + if (not SelectionChangeHandler): if GemRB.GameIsPCSelected (i): GemRB.GameControlSetScreenFlags (SF_CENTERONACTOR, OP_OR) @@ -647,6 +654,9 @@ def PortraitButtonOnPress (): def PortraitButtonOnShiftPress (): i = GemRB.GetVar ("PressedPortrait") + if not i: + return + if (not SelectionChangeHandler): sel = GemRB.GameIsPCSelected (i) sel = not sel @@ -720,8 +730,13 @@ def CheckDragging(): def PortraitButtonOnMouseLeave (): i = GemRB.GetVar ("PressedPortrait") - Button = PortraitWindow.GetControl (i) + if not i: + return + + Button = PortraitWindow.GetControl (i-1) Button.EnableBorder (FRAME_PC_TARGET, 0) + GemRB.SetVar ("PressedPortrait", 0) + GemRB.SetTimedEvent (CheckDragging, 1) return def ActionStopPressed (): -- 2.11.4.GIT