Do not fatal cause of missing spr/dat anymore.
This commit is contained in:
parent
10c564f90e
commit
e27423660c
|
@ -37,11 +37,6 @@ function Client.init()
|
|||
g_window.setIcon(resolvepath('clienticon.png'))
|
||||
g_keyboard.bindKeyDown('Ctrl+Shift+R', Client.reloadScripts)
|
||||
|
||||
-- load default client version
|
||||
local clientVersion = g_settings.getInteger('client-version')
|
||||
if not clientVersion or clientVersion == 0 then clientVersion = 960 end
|
||||
g_game.setClientVersion(clientVersion)
|
||||
|
||||
connect(g_app, { onRun =
|
||||
function()
|
||||
-- Play startup music (The Silver Tree, by Mattias Westlund)
|
||||
|
|
|
@ -67,9 +67,7 @@ function EnterGame.init()
|
|||
local host = g_settings.get('host')
|
||||
local port = g_settings.get('port')
|
||||
local autologin = g_settings.getBoolean('autologin')
|
||||
local clientVersion = g_game.getClientVersion()
|
||||
|
||||
if not clientVersion or clientVersion == 0 then clientVersion = 960 end
|
||||
local clientVersion = g_settings.getInteger('client-version')
|
||||
|
||||
if port == nil or port == 0 then port = 7171 end
|
||||
|
||||
|
@ -85,7 +83,10 @@ function EnterGame.init()
|
|||
for _i, proto in pairs(g_game.getSupportedProtocols()) do
|
||||
protocolBox:addOption(proto)
|
||||
end
|
||||
protocolBox:setCurrentOption(clientVersion)
|
||||
|
||||
if clientVersion then
|
||||
protocolBox:setCurrentOption(clientVersion)
|
||||
end
|
||||
|
||||
-- only open entergame when app starts
|
||||
if not g_app.isRunning() then
|
||||
|
|
|
@ -45,6 +45,9 @@ end
|
|||
function UIItem:onDestroy()
|
||||
if self == g_ui.getDraggingWidget() and self.hoveredWho then
|
||||
self.hoveredWho:setBorderWidth(0)
|
||||
end
|
||||
|
||||
if self.hoveredWho then
|
||||
self.hoveredWho = nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
filename = 'Tibia'
|
||||
|
||||
function init()
|
||||
connect(g_game, { onClientVersionChange = load })
|
||||
end
|
||||
|
@ -6,14 +8,24 @@ function terminate()
|
|||
disconnect(g_game, { onClientVersionChange = load })
|
||||
end
|
||||
|
||||
function setFileName(name)
|
||||
filename = name
|
||||
end
|
||||
|
||||
function load()
|
||||
local version = g_game.getClientVersion()
|
||||
local datPath = resolvepath(version .. '/Tibia.dat')
|
||||
local sprPath = resolvepath(version .. '/Tibia.spr')
|
||||
local datPath = resolvepath(version .. '/' .. filename .. '.dat')
|
||||
local sprPath = resolvepath(version .. '/' .. filename .. '.spr')
|
||||
|
||||
local errorMessage = ''
|
||||
if not g_things.loadDat(datPath) then
|
||||
fatal(tr("Unable to load dat file, please place a valid dat in '%s'", datPath))
|
||||
errorMessage = errorMessage .. tr("Unable to load dat file, please place a valid dat in '%s'", datPath) .. '\n'
|
||||
end
|
||||
if not g_sprites.loadSpr(sprPath) then
|
||||
fatal(tr("Unable to load spr file, please place a valid spr in '%s'", sprPath))
|
||||
errorMessage = errorMessage .. tr("Unable to load spr file, please place a valid spr in '%s'", sprPath) .. '\n'
|
||||
end
|
||||
|
||||
if errorMessage:len() > 0 then
|
||||
displayErrorBox(tr('Error'), errorMessage)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue