Fix some issues when reloading entergame

This commit is contained in:
Eduardo Bart 2013-01-31 14:19:31 -02:00
parent 546007f1df
commit 36a60419ec
2 changed files with 17 additions and 6 deletions

View File

@ -7,6 +7,7 @@ local motdWindow
local motdButton local motdButton
local enterGameButton local enterGameButton
local protocolBox local protocolBox
local protocolLogin
-- private functions -- private functions
local function onError(protocol, message, errorCode) local function onError(protocol, message, errorCode)
@ -47,8 +48,8 @@ local function onCharacterList(protocol, characters, account, otui)
local lastMotdNumber = g_settings.getNumber("motd") local lastMotdNumber = g_settings.getNumber("motd")
if G.motdNumber and G.motdNumber ~= lastMotdNumber then if G.motdNumber and G.motdNumber ~= lastMotdNumber then
g_settings.set("motd", motdNumber) g_settings.set("motd", motdNumber)
local motdBox = displayInfoBox(tr('Message of the day'), G.motdMessage) motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage)
connect(motdBox, { onOk = CharacterList.show }) connect(motdWindow, { onOk = function() CharacterList.show() motdWindow = nil end })
CharacterList.hide() CharacterList.hide()
end end
end end
@ -137,6 +138,7 @@ function EnterGame.terminate()
enterGame = nil enterGame = nil
enterGameButton:destroy() enterGameButton:destroy()
enterGameButton = nil enterGameButton = nil
protocolBox = nil
if motdWindow then if motdWindow then
motdWindow:destroy() motdWindow:destroy()
motdWindow = nil motdWindow = nil
@ -145,7 +147,14 @@ function EnterGame.terminate()
motdButton:destroy() motdButton:destroy()
motdButton = nil motdButton = nil
end end
protocolBox = nil if loadBox then
loadBox:destroy()
loadBox = nil
end
if protocolLogin then
protocolLogin:cancelLogin()
protocolLogin = nil
end
EnterGame = nil EnterGame = nil
end end
@ -195,7 +204,7 @@ function EnterGame.doLogin()
g_settings.set('host', G.host) g_settings.set('host', G.host)
g_settings.set('port', G.port) g_settings.set('port', G.port)
local protocolLogin = ProtocolLogin.create() protocolLogin = ProtocolLogin.create()
protocolLogin.onError = onError protocolLogin.onError = onError
protocolLogin.onMotd = onMotd protocolLogin.onMotd = onMotd
protocolLogin.onCharacterList = onCharacterList protocolLogin.onCharacterList = onCharacterList
@ -224,7 +233,7 @@ function EnterGame.doLogin()
end end
function EnterGame.displayMotd() 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 = displayInfoBox(tr('Message of the day'), G.motdMessage)
motdWindow.onOk = function() motdWindow = nil end motdWindow.onOk = function() motdWindow = nil end
end end

View File

@ -221,7 +221,9 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInf
message(STATUS "Debug information: ON") message(STATUS "Debug information: ON")
else() else()
message(STATUS "Debug information: OFF") message(STATUS "Debug information: OFF")
if(NOT CMAKE_BUILD_TYPE STREQUAL "CompileSpeed")
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DNDEBUG) # NDEBUG disable asserts 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 set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,--as-needed -Wl,-s") # strip all debug information
endif() endif()