From aaae6d54cddb4303f48fa468af245ad96e28d0e4 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 30 Dec 2015 12:15:01 -0500 Subject: [PATCH] exportlegends: Fix issues with entities with no race Some, such as specific site governments, have races of -1 Fixes #780 --- NEWS.rst | 1 + scripts/exportlegends.lua | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.rst b/NEWS.rst index c213b165f..d43229487 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -60,6 +60,7 @@ New Features Fixes ----- +- `exportlegends`: Handles entities without specific races - `showmood`: Fixed name display on OS X/Linux diff --git a/scripts/exportlegends.lua b/scripts/exportlegends.lua index 3c2999412..2ff14860d 100644 --- a/scripts/exportlegends.lua +++ b/scripts/exportlegends.lua @@ -205,7 +205,9 @@ function export_more_legends_xml() for entityK, entityV in ipairs(df.global.world.entities.all) do io.write ("\t".."".."\n") io.write ("\t\t"..""..entityV.id.."".."\n") - io.write ("\t\t"..""..(df.global.world.raws.creatures.all[entityV.race].creature_id):lower().."".."\n") + if entityV.race >= 0 then + io.write ("\t\t"..""..(df.global.world.raws.creatures.all[entityV.race].creature_id):lower().."".."\n") + end io.write ("\t\t"..""..(df.historical_entity_type[entityV.type]):lower().."".."\n") if (df.historical_entity_type[entityV.type]):lower() == "religion" then -- Get worshipped figure if (entityV.unknown1b ~= nil and entityV.unknown1b.worship ~= nill and