1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-06-27 15:43:11 +00:00

Remove legacy bHandleRawData check and fix file loading

While the check (most likely) wouldn't break anything, it's better to fix it and not worry then to not fix it and find out it breaks image loading. Also fixes how files are loaded.
This commit is contained in:
MineRobber___T 2017-07-15 18:31:42 -04:00 committed by GitHub
parent 71d024a76c
commit 11060596b1

View File

@ -41,17 +41,17 @@ function loadImage( sPath )
error( "bad argument #1 (expected string, got " .. type( sPath ) .. ")", 2 ) error( "bad argument #1 (expected string, got " .. type( sPath ) .. ")", 2 )
end end
if fs.exists( sPath ) and not bLoadRawData then if fs.exists( sPath ) then
local tImage = {} local tImage = {}
local file = io.open( sPath, "r" ) local file = io.open( sPath, "r" )
local sLine = file:read() local sLine = file:read()
local sContent = "" local sContent = ""
while sLine do while sLine do
sContent = sContent .. sLine .. "\n" sContent = sContent .. "\n" .. sLine
sLine = file:read() sLine = file:read()
end end
file:close() file:close()
return parseImage( sContent ) -- delegate parsing of images to parseImage function as suggested by @SquidDev in discussion of PR #378 return parseImage( sContent:sub(2) ) -- remove first newline and delegate parsing of images to parseImage function as suggested by @SquidDev in discussion of PR #378
end end
return nil return nil
end end