Do not fatal cause of missing spr/dat anymore.

This commit is contained in:
Henrique Santiago
2012-08-09 19:54:03 -03:00
parent 10c564f90e
commit e27423660c
4 changed files with 24 additions and 13 deletions

View File

@@ -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