Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rewrite OpenStoreRentWindow so as not to require UpdateVarAssoc

  • Loading branch information...
commit f6907e2fb814f30cab62d76c4fe526fa6a78e0bb 1 parent ed1c80e
@fizzet fizzet authored
View
1  gemrb/GUIScripts/GUIClasses.py
@@ -62,7 +62,6 @@ class GWindow:
'SetVisible': _GemRB.Window_SetVisible,
'ShowModal': _GemRB.Window_ShowModal,
'Invalidate': _GemRB.Window_Invalidate,
- 'UpdateVarAssoc': _GemRB.Window_UpdateVarAssoc
}
def __nonzero__(self):
return self.ID != -1
View
21 gemrb/GUIScripts/GUISTORE.py
@@ -51,7 +51,6 @@
ITEM_STORE = 1
Inventory = None
-RentIndex = -1
Store = None
Buttons = [-1,-1,-1,-1]
inventory_slots = ()
@@ -584,7 +583,7 @@ def OpenStoreRumourWindow ():
return
def OpenStoreRentWindow ():
- global StoreRentWindow, RentIndex
+ global StoreRentWindow
CloseWindows()
@@ -594,14 +593,21 @@ def OpenStoreRentWindow ():
RentIndex = -1
for i in range (4):
ok = Store['StoreRoomPrices'][i]
+ if ok >= 0:
+ RentIndex = i
+ break
+
+ # RentIndex needs to be set before SetVarAssoc
+ GemRB.SetVar ("RentIndex", RentIndex)
+
+ for i in range (4):
+ ok = Store['StoreRoomPrices'][i]
Button = Window.GetControl (i)
Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateStoreRentWindow)
if ok<0:
Button.SetState (IE_GUI_BUTTON_DISABLED) #disabled room icons are selected, not disabled
else:
Button.SetVarAssoc ("RentIndex", i)
- if RentIndex==-1:
- RentIndex = i
Button = Window.GetControl (i+4)
Button.SetText (14294+i)
@@ -620,9 +626,6 @@ def OpenStoreRentWindow ():
Button.SetText (14293)
Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RentRoom)
- GemRB.SetVar ("RentIndex", RentIndex)
- Window.UpdateVarAssoc ("RentIndex")
-
GUICommonWindows.SetSelectionChangeHandler( UpdateStoreRentWindow )
UpdateStoreRentWindow ()
Window.SetVisible (WINDOW_VISIBLE)
@@ -1543,8 +1546,6 @@ def GulpDrink ():
return
def UpdateStoreRentWindow ():
- global RentIndex
-
Window = StoreRentWindow
UpdateStoreCommon (Window, 0x10000008, 0, 0x10000009)
RentIndex = GemRB.GetVar ("RentIndex")
@@ -1590,7 +1591,7 @@ def RentDeny () :
return
def RentRoom ():
- global RentIndex, RentConfirmWindow
+ global RentConfirmWindow
RentIndex = GemRB.GetVar ("RentIndex")
price = Store['StoreRoomPrices'][RentIndex]
View
24 gemrb/plugins/GUIScript/GUIScript.cpp
@@ -1927,29 +1927,6 @@ static PyObject* GemRB_Control_SetVarAssoc(PyObject * /*self*/, PyObject* args)
return Py_None;
}
-PyDoc_STRVAR( GemRB_Window_UpdateVarAssoc__doc,
-"UpdateVarAssoc(WindowIndex)\n\n"
-"Redraw controls in the given Window associated with a variable." );
-
-static PyObject* GemRB_Window_UpdateVarAssoc(PyObject * /*self*/, PyObject* args)
-{
- int WindowIndex;
- ieDword Value;
- char* VarName;
-
- if (!PyArg_ParseTuple( args, "is", &WindowIndex, &VarName )) {
- return AttributeError( GemRB_Window_UpdateVarAssoc__doc );
- }
-
- Value = 0;
- core->GetDictionary()->Lookup( VarName, Value );
- Window* win = core->GetWindow( WindowIndex );
- win->RedrawControls(VarName, Value);
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
PyDoc_STRVAR( GemRB_Window_Unload__doc,
"UnloadWindow(WindowIndex)\n\n"
"Unloads a previously Loaded Window." );
@@ -10895,7 +10872,6 @@ static PyMethodDef GemRBInternalMethods[] = {
METHOD(Window_SetupEquipmentIcons, METH_VARARGS),
METHOD(Window_ShowModal, METH_VARARGS),
METHOD(Window_Unload, METH_VARARGS),
- METHOD(Window_UpdateVarAssoc, METH_VARARGS),
METHOD(WorldMap_AdjustScrolling, METH_VARARGS),
METHOD(WorldMap_GetDestinationArea, METH_VARARGS),
METHOD(WorldMap_SetTextColor, METH_VARARGS),
Please sign in to comment.
Something went wrong with that request. Please try again.