From 36a60419ec75f8f50bb4a306979a0a7ce02a112b Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Thu, 31 Jan 2013 14:19:31 -0200 Subject: [PATCH] Fix some issues when reloading entergame --- modules/client_entergame/entergame.lua | 19 ++++++++++++++----- src/framework/CMakeLists.txt | 4 +++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index 19d1f7cb..4ed01279 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -7,6 +7,7 @@ local motdWindow local motdButton local enterGameButton local protocolBox +local protocolLogin -- private functions local function onError(protocol, message, errorCode) @@ -47,8 +48,8 @@ local function onCharacterList(protocol, characters, account, otui) local lastMotdNumber = g_settings.getNumber("motd") if G.motdNumber and G.motdNumber ~= lastMotdNumber then g_settings.set("motd", motdNumber) - local motdBox = displayInfoBox(tr('Message of the day'), G.motdMessage) - connect(motdBox, { onOk = CharacterList.show }) + motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage) + connect(motdWindow, { onOk = function() CharacterList.show() motdWindow = nil end }) CharacterList.hide() end end @@ -137,6 +138,7 @@ function EnterGame.terminate() enterGame = nil enterGameButton:destroy() enterGameButton = nil + protocolBox = nil if motdWindow then motdWindow:destroy() motdWindow = nil @@ -145,7 +147,14 @@ function EnterGame.terminate() motdButton:destroy() motdButton = nil end - protocolBox = nil + if loadBox then + loadBox:destroy() + loadBox = nil + end + if protocolLogin then + protocolLogin:cancelLogin() + protocolLogin = nil + end EnterGame = nil end @@ -195,7 +204,7 @@ function EnterGame.doLogin() g_settings.set('host', G.host) g_settings.set('port', G.port) - local protocolLogin = ProtocolLogin.create() + protocolLogin = ProtocolLogin.create() protocolLogin.onError = onError protocolLogin.onMotd = onMotd protocolLogin.onCharacterList = onCharacterList @@ -224,7 +233,7 @@ function EnterGame.doLogin() end function EnterGame.displayMotd() - if not motdWindow or not motdWindow:isVisible() then + if not motdWindow then motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage) motdWindow.onOk = function() motdWindow = nil end end diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index aa3e7ed8..4316cd1b 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -221,7 +221,9 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInf message(STATUS "Debug information: ON") else() message(STATUS "Debug information: OFF") - set(framework_DEFINITIONS ${framework_DEFINITIONS} -DNDEBUG) # NDEBUG disable asserts + if(NOT CMAKE_BUILD_TYPE STREQUAL "CompileSpeed") + set(framework_DEFINITIONS ${framework_DEFINITIONS} -DNDEBUG) # NDEBUG disable asserts + endif() set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,--as-needed -Wl,-s") # strip all debug information endif()