git show HEAD -b
commit 6c46e5dc472f1028e90f1421c249eca00b340317
Author: Alberth <alberth289346@gmail.com>
Date: Fri Feb 20 21:09:02 2015 +0100
Feature: Skip examining the custom graphics folder if custom graphics are disabled.
diff --git a/CorsixTH/Lua/graphics.lua b/CorsixTH/Lua/graphics.lua
index ec13972..1460d49 100644
--- a/CorsixTH/Lua/graphics.lua
+++ b/CorsixTH/Lua/graphics.lua
@@ -95,10 +95,11 @@ function Graphics:Graphics(app)
self:loadFontFile()
+ local graphics_folder = nil
+ if self.app.config.use_new_graphics then
-- Check if the config specifies a place to look for graphics in.
-- Otherwise check in the default "Graphics" folder.
-
- local graphics_folder = self.app.config.new_graphics_folder or ourpath .. "Graphics"
+ graphics_folder = self.app.config.new_graphics_folder or ourpath .. "Graphics"
if graphics_folder:sub(-1) ~= pathsep then
graphics_folder = graphics_folder .. pathsep
end
@@ -114,6 +115,7 @@ function Graphics:Graphics(app)
print("Error: An invalid custom graphics mapping file was found")
end
end
+ end
self.custom_graphics_folder = graphics_folder
end
@@ -446,8 +448,7 @@ function Graphics:loadAnimations(dir, prefix)
error("Cannot load original animations " .. prefix)
end
- if self.app.config.use_new_graphics then
- if self.custom_graphics.file_mapping then
+ if self.custom_graphics_folder and self.custom_graphics.file_mapping then
for _, fname in pairs(self.custom_graphics.file_mapping) do
anims:setCanvas(self.target)
local data, err = loadCustomAnims(self.custom_graphics_folder .. fname)
@@ -458,7 +459,6 @@ function Graphics:loadAnimations(dir, prefix)
end
end
end
- end
self.cache.anims[prefix] = anims
self.load_info[anims] = {self.loadAnimations, self, dir, prefix}