Skip to content

Commit ccc4674

Browse files
committed
gui/petition: fix deity display
1 parent af457f9 commit ccc4674

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Template for new versions:
3232

3333
## Fixes
3434

35+
- `gui/petitions`: fix deity display
36+
3537
## Misc Improvements
3638

3739
## Removed

list-agreements.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,19 @@ function get_agr_party_name(agr)
7171
return party_name
7272
end
7373

74+
---@param agr df.agreement
7475
function get_deity_name(agr)
75-
local religion_id = agr.details[0].data.Location.deity_data.Religion
76-
local deities = df.global.world.entities.all[religion_id].relations.deities
77-
if #deities == 0 then return 'An Unknown Deity' end
78-
return dfhack.translation.translateName(df.global.world.history.figures[deities[0]].name,true)
76+
local practice_type = agr.details[0].data.Location.deity_type
77+
local practice_id = agr.details[0].data.Location.deity_data.practice_id -- could be either entity_id or hf_id
78+
if practice_type == df.religious_practice_type.WORSHIP_HFID then
79+
local hf = df.historical_figure.find(practice_id)
80+
if not hf then return 'An Unknown Deity' end
81+
return dfhack.translation.translateName(hf.name, true)
82+
else
83+
local deities = df.global.world.entities.all[practice_id].relations.deities
84+
if #deities == 0 then return 'An Unknown Deity' end
85+
return dfhack.translation.translateName(df.global.world.history.figures[deities[0]].name, true)
86+
end
7987
end
8088

8189
--get resolution status, and string

0 commit comments

Comments
 (0)