diff options
author | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-11-23 10:39:11 -0500 |
---|---|---|
committer | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-11-23 10:39:11 -0500 |
commit | 2d8ff9f889450fb5c36016276997544aae98a350 (patch) | |
tree | 636ddf5e6a9b444a60d7cab82e93ccffb037355d /signs_lib | |
parent | 646d696c62a6b408100e65164b5cd71a4793ab9b (diff) | |
download | dreambuilder_modpack-2d8ff9f889450fb5c36016276997544aae98a350.tar dreambuilder_modpack-2d8ff9f889450fb5c36016276997544aae98a350.tar.gz dreambuilder_modpack-2d8ff9f889450fb5c36016276997544aae98a350.tar.bz2 dreambuilder_modpack-2d8ff9f889450fb5c36016276997544aae98a350.tar.xz dreambuilder_modpack-2d8ff9f889450fb5c36016276997544aae98a350.zip |
update digistuff, farming-redo, homedecor, hotbar, roads,
pipeworks, prefab_redo, rgblightstone, signs_lib, street_signs,
technic, unifieddyes, and worldedit
Diffstat (limited to 'signs_lib')
-rw-r--r-- | signs_lib/init.lua | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/signs_lib/init.lua b/signs_lib/init.lua index 8e0d047..82a0f1b 100644 --- a/signs_lib/init.lua +++ b/signs_lib/init.lua @@ -26,6 +26,9 @@ signs_lib.gettext = S -- text encoding dofile(signs_lib.path .. "/encoding.lua"); +-- Initialize character texture cache +local ctexcache = {} + local wall_dir_change = { [0] = 4, @@ -362,14 +365,19 @@ end -- make char texture file name -- if texture file does not exist use fallback texture instead local function char_tex(font_name, ch) - local c = ch:byte() - local exists, tex = file_exists(CHAR_PATH:format(font_name, c)) - if exists and c ~= 14 then - tex = CHAR_FILE:format(font_name, c) + if ctexcache[font_name..ch] then + return ctexcache[font_name..ch], true else - tex = CHAR_FILE:format(font_name, 0x0) + local c = ch:byte() + local exists, tex = file_exists(CHAR_PATH:format(font_name, c)) + if exists and c ~= 14 then + tex = CHAR_FILE:format(font_name, c) + else + tex = CHAR_FILE:format(font_name, 0x0) + end + ctexcache[font_name..ch] = tex + return tex, exists end - return tex, exists end local function make_line_texture(line, lineno, pos) |