From 73a67b4a64326025c8c58a6e4ef7afa3da368dfb Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Sat, 16 Aug 2014 15:50:01 -0600 Subject: [PATCH 1/2] Repairing the log-region script A typo was causing the gamelog to always omit the fortress group's untranslated name, while failing to fully prevent the error message caused by unloading the fortress. --- scripts/log-region.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/log-region.lua b/scripts/log-region.lua index 1895336cb..c548ee93b 100644 --- a/scripts/log-region.lua +++ b/scripts/log-region.lua @@ -7,6 +7,10 @@ local function write_gamelog(msg) log:close() end +local function fullname(item) + return dfhack.TranslateName(item.name)..' ('..dfhack.TranslateName(item.name ,true)..')' +end + local args = {...} if args[1] == 'disable' then dfhack.onStateChange[_ENV] = nil @@ -17,7 +21,7 @@ else local site = df.world_site.find(df.global.ui.site_id) local fort_ent = df.global.ui.main.fortress_entity local civ_ent = df.historical_entity.find(df.global.ui.civ_id) - local worldname = df.global.world.world_data.name + local worldname = df.global.world.world_data -- site positions -- site .pos.x .pos.y -- site .rgn_min_x .rgn_min_y .rgn_max_x .rgn_max.y @@ -26,9 +30,11 @@ else --fort_ent.name --civ_ent.name - write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..dfhack.TranslateName(worldname)..' ('..dfhack.TranslateName(worldname ,true)..') at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE.. - 'Loaded the fortress '..dfhack.TranslateName(site.name)..' ('..dfhack.TranslateName(site.name, true)..'), colonized by the group '..(fort_end and dfhack.TranslateName(fort_ent.name) or '(nobody?)')..' ('..dfhack.TranslateName(fort_ent.name,true).. - ') of the civilization '..dfhack.TranslateName(civ_ent.name)..' ('..dfhack.TranslateName(civ_ent.name,true)..').'..NEWLINE) + write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..fullname(worldname).. + ' at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE.. + 'Loaded the fortress '..fullname(site).. + (fort_ent and ', colonized by the group '..fullname(fort_ent) or '').. + (civ_ent and ' of the civilization '..fullname(civ_ent) or '')..'.'..NEWLINE) end end end From eeb22c099d65aeb85933949d6154aad3ef96633c Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Thu, 28 Aug 2014 14:02:22 -0600 Subject: [PATCH 2/2] Nitpicking log-region One line was improperly indented, and a variable name no longer made sense. --- scripts/log-region.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/log-region.lua b/scripts/log-region.lua index c548ee93b..2da2da773 100644 --- a/scripts/log-region.lua +++ b/scripts/log-region.lua @@ -21,7 +21,7 @@ else local site = df.world_site.find(df.global.ui.site_id) local fort_ent = df.global.ui.main.fortress_entity local civ_ent = df.historical_entity.find(df.global.ui.civ_id) - local worldname = df.global.world.world_data + local world = df.global.world -- site positions -- site .pos.x .pos.y -- site .rgn_min_x .rgn_min_y .rgn_max_x .rgn_max.y @@ -30,12 +30,12 @@ else --fort_ent.name --civ_ent.name - write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..fullname(worldname).. + write_gamelog('Loaded '..world.cur_savegame.save_dir..', '..fullname(world.world_data).. ' at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE.. 'Loaded the fortress '..fullname(site).. (fort_ent and ', colonized by the group '..fullname(fort_ent) or '').. (civ_ent and ' of the civilization '..fullname(civ_ent) or '')..'.'..NEWLINE) end - end + end end end