Browse Source

Do not fatal cause of missing spr/dat anymore.

Henrique Santiago 8 years ago
parent
commit
e27423660c

+ 0
- 5
modules/client/client.lua View File

@@ -37,11 +37,6 @@ function Client.init()
37 37
   g_window.setIcon(resolvepath('clienticon.png'))
38 38
   g_keyboard.bindKeyDown('Ctrl+Shift+R', Client.reloadScripts)
39 39
 
40
-  -- load default client version
41
-  local clientVersion = g_settings.getInteger('client-version')
42
-  if not clientVersion or clientVersion == 0 then clientVersion = 960 end
43
-  g_game.setClientVersion(clientVersion)
44
-
45 40
   connect(g_app, { onRun =
46 41
     function()
47 42
       -- Play startup music (The Silver Tree, by Mattias Westlund)

+ 5
- 4
modules/client_entergame/entergame.lua View File

@@ -67,9 +67,7 @@ function EnterGame.init()
67 67
   local host = g_settings.get('host')
68 68
   local port = g_settings.get('port')
69 69
   local autologin = g_settings.getBoolean('autologin')
70
-  local clientVersion = g_game.getClientVersion()
71
-
72
-  if not clientVersion or clientVersion == 0 then clientVersion = 960 end
70
+  local clientVersion = g_settings.getInteger('client-version')
73 71
 
74 72
   if port == nil or port == 0 then port = 7171 end
75 73
 
@@ -85,7 +83,10 @@ function EnterGame.init()
85 83
   for _i, proto in pairs(g_game.getSupportedProtocols()) do
86 84
     protocolBox:addOption(proto)
87 85
   end
88
-  protocolBox:setCurrentOption(clientVersion)
86
+
87
+  if clientVersion then
88
+    protocolBox:setCurrentOption(clientVersion)
89
+  end
89 90
 
90 91
   -- only open entergame when app starts
91 92
   if not g_app.isRunning() then

+ 3
- 0
modules/game_interface/widgets/uiitem.lua View File

@@ -45,6 +45,9 @@ end
45 45
 function UIItem:onDestroy()
46 46
   if self == g_ui.getDraggingWidget() and self.hoveredWho then
47 47
     self.hoveredWho:setBorderWidth(0)
48
+  end
49
+
50
+  if self.hoveredWho then
48 51
     self.hoveredWho = nil
49 52
   end
50 53
 end

+ 16
- 4
modules/game_tibiafiles/tibiafiles.lua View File

@@ -1,3 +1,5 @@
1
+filename = 'Tibia'
2
+
1 3
 function init()
2 4
   connect(g_game, { onClientVersionChange = load })
3 5
 end
@@ -6,14 +8,24 @@ function terminate()
6 8
   disconnect(g_game, { onClientVersionChange = load })
7 9
 end
8 10
 
11
+function setFileName(name)
12
+  filename = name
13
+end
14
+
9 15
 function load()
10 16
   local version = g_game.getClientVersion()
11
-  local datPath = resolvepath(version .. '/Tibia.dat')
12
-  local sprPath = resolvepath(version .. '/Tibia.spr')
17
+  local datPath = resolvepath(version .. '/' .. filename .. '.dat')
18
+  local sprPath = resolvepath(version .. '/' .. filename .. '.spr')
19
+
20
+  local errorMessage = ''
13 21
   if not g_things.loadDat(datPath) then
14
-    fatal(tr("Unable to load dat file, please place a valid dat in '%s'", datPath))
22
+    errorMessage = errorMessage .. tr("Unable to load dat file, please place a valid dat in '%s'", datPath) .. '\n'
15 23
   end
16 24
   if not g_sprites.loadSpr(sprPath) then
17
-    fatal(tr("Unable to load spr file, please place a valid spr in '%s'", sprPath))
25
+    errorMessage = errorMessage .. tr("Unable to load spr file, please place a valid spr in '%s'", sprPath) .. '\n'
26
+  end
27
+
28
+  if errorMessage:len() > 0 then
29
+    displayErrorBox(tr('Error'), errorMessage)
18 30
   end
19 31
 end

Loading…
Cancel
Save