Browse Source

Re-add destroying for unloading, other clean up:

* Cleaned some module terminate code
* Fixed "reload all" issues
BeniS 8 years ago
parent
commit
7f5dda5c8f

+ 0
- 1
modules/client_background/background.lua View File

@@ -25,7 +25,6 @@ function terminate()
25 25
 
26 26
   g_effects.cancelFade(background:getChildById('clientVersionLabel'))
27 27
   background:destroy()
28
-  background = nil
29 28
 
30 29
   Background = nil
31 30
 end

+ 6
- 0
modules/client_entergame/entergame.lua View File

@@ -136,11 +136,17 @@ function EnterGame.terminate()
136 136
   removeEvent(autoLoginEvent)
137 137
   enterGame:destroy()
138 138
   enterGame = nil
139
+  enterGameButton:destroy()
140
+  enterGameButton = nil
139 141
   protocolBox = nil
140 142
   if motdWindow then
141 143
     motdWindow:destroy()
142 144
     motdWindow = nil
143 145
   end
146
+  if motdButton then
147
+    motdButton:destroy()
148
+    motdButton = nil
149
+  end
144 150
   if loadBox then
145 151
     loadBox:destroy()
146 152
     loadBox = nil

+ 1
- 1
modules/client_modulemanager/modulemanager.lua View File

@@ -22,7 +22,7 @@ end
22 22
 
23 23
 function terminate()
24 24
   moduleManagerWindow:destroy()
25
-  moduleManagerWindow = nil
25
+  moduleManagerButton:destroy()
26 26
   moduleList = nil
27 27
 end
28 28
 

+ 2
- 1
modules/client_options/options.lua View File

@@ -118,7 +118,8 @@ function terminate()
118 118
   --g_keyboard.unbindKeyDown('Ctrl+D')
119 119
   g_keyboard.unbindKeyDown('Ctrl+Shift+F')
120 120
   optionsWindow:destroy()
121
-  optionsWindow = nil
121
+  optionsButton:destroy()
122
+  audioButton:destroy()
122 123
   optionsTabBar = nil
123 124
   generalPanel = nil
124 125
   consolePanel = nil

+ 1
- 3
modules/client_terminal/terminal.lua View File

@@ -150,10 +150,8 @@ function terminate()
150 150
   g_settings.setList('terminal-history', commandHistory)
151 151
   g_keyboard.unbindKeyDown('Ctrl+T')
152 152
   g_logger.setOnLog(nil)
153
-  commandTextEdit = nil
154
-  terminalBuffer = nil
155 153
   terminalWindow:destroy()
156
-  terminalWindow = nil
154
+  terminalButton:destroy()
157 155
   commandEnv = nil
158 156
 end
159 157
 

+ 0
- 6
modules/client_topmenu/topmenu.lua View File

@@ -57,13 +57,7 @@ function terminate()
57 57
   disconnect(g_game, { onGameStart = showGameButtons,
58 58
                        onGameEnd = hideGameButtons })
59 59
 
60
-  leftButtonsPanel = nil
61
-  rightButtonsPanel = nil
62
-  leftGameButtonsPanel = nil
63
-  rightGameButtonsPanel = nil
64
-
65 60
   topMenu:destroy()
66
-  topMenu = nil
67 61
 end
68 62
 
69 63
 function addLeftButton(id, description, icon, callback, front)

+ 1
- 0
modules/game_combatcontrols/combatcontrols.lua View File

@@ -51,6 +51,7 @@ function terminate()
51 51
 
52 52
   fightModeRadioGroup:destroy()
53 53
   combatControlsWindow:destroy()
54
+  combatControlsButton:destroy()
54 55
 
55 56
   disconnect(g_game, {
56 57
     onGameStart = online,

+ 4
- 12
modules/game_console/console.lua View File

@@ -73,9 +73,9 @@ violationWindow = nil
73 73
 violationReportTab = nil
74 74
 
75 75
 local ignoreSettings = {
76
-    privateMessages = false,
77
-    yelling = false,
78
-    players = {}
76
+  privateMessages = false,
77
+  yelling = false,
78
+  players = {}
79 79
 }
80 80
 
81 81
 function init()
@@ -164,25 +164,17 @@ function terminate()
164 164
   
165 165
   if channelsWindow then
166 166
     channelsWindow:destroy()
167
-    channelsWindow = nil
168 167
   end
169 168
   
170 169
   if ignoreWindow then
171 170
     ignoreWindow:destroy()
172
-    ignoreWindow = nil
173 171
   end
174 172
 
175 173
   if violationWindow then
176 174
     violationWindow:destroy()
177
-    violationWindow = nil
178 175
   end
179
-
176
+  
180 177
   consolePanel:destroy()
181
-  consolePanel = nil
182
-  consoleTextEdit = nil
183
-  consoleContentPanel = nil
184
-  consoleTabBar = nil
185
-
186 178
   ownPrivateName = nil
187 179
 
188 180
   Console = nil

+ 1
- 0
modules/game_cooldown/cooldown.lua View File

@@ -36,6 +36,7 @@ function terminate()
36 36
                        onSpellCooldown = onSpellCooldown })
37 37
 
38 38
   cooldownWindow:destroy()
39
+  cooldownButton:destroy()
39 40
 end
40 41
 
41 42
 function onMiniWindowClose()

+ 1
- 13
modules/game_healthinfo/healthinfo.lua View File

@@ -70,19 +70,7 @@ function terminate()
70 70
   disconnect(g_game, { onGameEnd = offline })
71 71
 
72 72
   healthInfoWindow:destroy()
73
-  healthInfoWindow = nil
74
-  healthInfoButton = nil
75
-
76
-  healthBar = nil
77
-  manaBar = nil
78
-  soulBar = nil
79
-
80
-  healthLabel = nil
81
-  manaLabel = nil
82
-  soulLabel = nil
83
-  capLabel = nil
84
-
85
-  HealthInfo = nil
73
+  healthInfoButton:destroy()
86 74
 end
87 75
 
88 76
 function toggle()

+ 1
- 0
modules/game_hotkeys/hotkeys_manager.lua View File

@@ -88,6 +88,7 @@ function terminate()
88 88
   unload()
89 89
 
90 90
   hotkeysWindow:destroy()
91
+  hotkeysButton:destroy()
91 92
   mouseGrabberWidget:destroy()
92 93
 end
93 94
 

+ 4
- 2
modules/game_interface/gameinterface.lua View File

@@ -123,11 +123,11 @@ function terminate()
123 123
 
124 124
   disconnect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
125 125
 
126
+  logoutButton:destroy()
126 127
   gameRootPanel:destroy()
127 128
 end
128 129
 
129 130
 function onGameStart()
130
-  logoutButton:setTooltip(tr('Logout'))
131 131
   show()
132 132
 
133 133
   -- open tibia has delay in auto walking
@@ -139,7 +139,6 @@ function onGameStart()
139 139
 end
140 140
 
141 141
 function onGameEnd()
142
-  logoutButton:setTooltip(tr('Exit'))
143 142
   setupViewMode(0)
144 143
   hide()
145 144
 end
@@ -151,10 +150,13 @@ function show()
151 150
   gameRootPanel:focus()
152 151
   gameMapPanel:followCreature(g_game.getLocalPlayer())
153 152
   updateStretchShrink()
153
+  logoutButton:setTooltip(tr('Logout'))
154 154
 end
155 155
 
156 156
 function hide()
157 157
   disconnect(g_app, { onClose = tryExit })
158
+  logoutButton:setTooltip(tr('Exit'))
159
+  
158 160
   if logoutWindow then
159 161
     logoutWindow:destroy()
160 162
     logoutWindow = nil

+ 1
- 0
modules/game_inventory/inventory.lua View File

@@ -39,6 +39,7 @@ function terminate()
39 39
   g_keyboard.unbindKeyDown('Ctrl+I')
40 40
 
41 41
   inventoryWindow:destroy()
42
+  inventoryButton:destroy()
42 43
 end
43 44
 
44 45
 function refresh()

+ 1
- 3
modules/game_market/market.lua View File

@@ -737,9 +737,7 @@ function terminate()
737 737
   disconnect(g_game, { onGameEnd = Market.reset })
738 738
   disconnect(g_game, { onGameEnd = Market.close })
739 739
 
740
-  if marketWindow then
741
-    marketWindow:destroy()
742
-  end
740
+  marketWindow:destroy()
743 741
 
744 742
   Market = nil
745 743
 end

+ 1
- 0
modules/game_minimap/minimap.lua View File

@@ -49,6 +49,7 @@ function terminate()
49 49
   g_keyboard.unbindKeyDown('Ctrl+M')
50 50
 
51 51
   minimapWindow:destroy()
52
+  minimapButton:destroy()
52 53
 end
53 54
 
54 55
 function toggle()

+ 0
- 1
modules/game_playerdeath/playerdeath.lua View File

@@ -17,7 +17,6 @@ end
17 17
 function reset()
18 18
   if deathWindow then
19 19
     deathWindow:destroy()
20
-    deathWindow = nil
21 20
   end
22 21
 end
23 22
 

+ 1
- 0
modules/game_playermount/playermount.lua View File

@@ -11,6 +11,7 @@ function terminate()
11 11
     onGameStart = online,
12 12
     onGameEnd = offline
13 13
   })
14
+  offline()
14 15
 end
15 16
 
16 17
 function online()

+ 1
- 2
modules/game_questlog/questlog.lua View File

@@ -18,17 +18,16 @@ function terminate()
18 18
                        onGameEnd = destroyWindows})
19 19
 
20 20
   destroyWindows()
21
+  questLogButton:destroy()
21 22
 end
22 23
 
23 24
 function destroyWindows()
24 25
   if questLogWindow then
25 26
     questLogWindow:destroy()
26
-    questLogWindow = nil
27 27
   end
28 28
 
29 29
   if questLineWindow then
30 30
     questLineWindow:destroy()
31
-    questLineWindow = nil
32 31
   end
33 32
 end
34 33
 

+ 3
- 0
modules/game_skills/skills.lua View File

@@ -61,6 +61,7 @@ function terminate()
61 61
 
62 62
   g_keyboard.unbindKeyDown('Ctrl+S')
63 63
   skillsWindow:destroy()
64
+  skillsButton:destroy()
64 65
 end
65 66
 
66 67
 function expForLevel(level)
@@ -231,6 +232,8 @@ end
231 232
 
232 233
 function checkExpSpeed()
233 234
   local player = g_game.getLocalPlayer()
235
+  if not player then return end
236
+  
234 237
   local currentExp = player:getExperience()
235 238
   local currentTime = g_clock.seconds()
236 239
   if player.lastExps ~= nil then

+ 1
- 31
modules/game_spelllist/spelllist.lua View File

@@ -173,41 +173,11 @@ function terminate()
173 173
                         end })   
174 174
 
175 175
   spelllistWindow:destroy()
176
-  spelllistWindow       = nil
176
+  spelllistButton:destroy()
177 177
   
178 178
   vocationRadioGroup:destroy()
179
-  vocationRadioGroup    = nil
180 179
   groupRadioGroup:destroy()
181
-  groupRadioGroup       = nil
182 180
   premiumRadioGroup:destroy()
183
-  premiumRadioGroup     = nil
184
-  
185
-  spellList             = nil
186
-  nameValueLabel        = nil
187
-  formulaValueLabel     = nil
188
-  vocationValueLabel    = nil
189
-  groupValueLabel       = nil
190
-  typeValueLabel        = nil
191
-  cooldownValueLabel    = nil
192
-  levelValueLabel       = nil
193
-  manaValueLabel        = nil
194
-  premiumValueLabel     = nil
195
-  descriptionValueLabel = nil
196
-
197
-  vocationBoxAny        = nil
198
-  vocationBoxSorcerer   = nil
199
-  vocationBoxDruid      = nil
200
-  vocationBoxPaladin    = nil
201
-  vocationBoxKnight     = nil
202
-
203
-  groupBoxAny           = nil
204
-  groupBoxAttack        = nil
205
-  groupBoxHealing       = nil
206
-  groupBoxSupport       = nil
207
-
208
-  premiumBoxAny         = nil
209
-  premiumBoxNo          = nil
210
-  premiumBoxYes         = nil
211 181
 end
212 182
 
213 183
 function initialiseSpelllist()

+ 0
- 1
modules/game_viplist/viplist.lua View File

@@ -35,7 +35,6 @@ function refresh()
35 35
   end
36 36
 
37 37
   vipWindow:setContentMinimumHeight(38)
38
-  --vipWindow:setContentMaximumHeight(256)
39 38
 end
40 39
 
41 40
 function clear()

Loading…
Cancel
Save