Loading

Paste #pn1ygy7ra

  1. git show HEAD -b
  2. commit 6c46e5dc472f1028e90f1421c249eca00b340317
  3. Author: Alberth <alberth289346@gmail.com>
  4. Date:   Fri Feb 20 21:09:02 2015 +0100
  5.  
  6.     Feature: Skip examining the custom graphics folder if custom graphics are disabled.
  7.  
  8. diff --git a/CorsixTH/Lua/graphics.lua b/CorsixTH/Lua/graphics.lua
  9. index ec13972..1460d49 100644
  10. --- a/CorsixTH/Lua/graphics.lua
  11. +++ b/CorsixTH/Lua/graphics.lua
  12. @@ -95,10 +95,11 @@ function Graphics:Graphics(app)
  13.  
  14.    self:loadFontFile()
  15.  
  16. +  local graphics_folder = nil
  17. +  if self.app.config.use_new_graphics then
  18.      -- Check if the config specifies a place to look for graphics in.
  19.      -- Otherwise check in the default "Graphics" folder.
  20. -
  21. -  local graphics_folder = self.app.config.new_graphics_folder or ourpath .. "Graphics"
  22. +    graphics_folder = self.app.config.new_graphics_folder or ourpath .. "Graphics"
  23.      if graphics_folder:sub(-1) ~= pathsep then
  24.        graphics_folder = graphics_folder .. pathsep
  25.      end
  26. @@ -114,6 +115,7 @@ function Graphics:Graphics(app)
  27.          print("Error: An invalid custom graphics mapping file was found")
  28.        end
  29.      end
  30. +  end
  31.    self.custom_graphics_folder = graphics_folder
  32.  end
  33.  
  34. @@ -446,8 +448,7 @@ function Graphics:loadAnimations(dir, prefix)
  35.      error("Cannot load original animations " .. prefix)
  36.    end
  37.  
  38. -  if self.app.config.use_new_graphics then
  39. -    if self.custom_graphics.file_mapping then
  40. +  if self.custom_graphics_folder and self.custom_graphics.file_mapping then
  41.      for _, fname in pairs(self.custom_graphics.file_mapping) do
  42.        anims:setCanvas(self.target)
  43.        local data, err = loadCustomAnims(self.custom_graphics_folder .. fname)
  44. @@ -458,7 +459,6 @@ function Graphics:loadAnimations(dir, prefix)
  45.        end
  46.      end
  47.    end
  48. -  end
  49.  
  50.    self.cache.anims[prefix] = anims
  51.    self.load_info[anims] = {self.loadAnimations, self, dir, prefix}

Comments