Skip to content

Commit

Permalink
Merge pull request #764 from myk002/myk_upup
Browse files Browse the repository at this point in the history
adapt to core library changes
  • Loading branch information
myk002 authored Jul 6, 2023
2 parents a425689 + 703b5f0 commit 64aff9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 38 deletions.
8 changes: 0 additions & 8 deletions gui/launcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -518,14 +518,6 @@ end
function MainPanel:onInput(keys)
if MainPanel.super.onInput(self, keys) then
return true
elseif keys.CUSTOM_CTRL_C then
if self.focus_group.cur == self.subviews.editfield then
self.subviews.edit:set_text('')
self.on_edit_input('')
else
self.focus_group.cur:setText('')
end
return true
elseif keys.CUSTOM_CTRL_D then
dev_mode = not dev_mode
self.update_autocomplete(get_first_word(self.subviews.editfield.text))
Expand Down
33 changes: 3 additions & 30 deletions internal/quickfort/zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -226,37 +226,10 @@ local function parse_location_props(props)
return location_data
end

local function get_noble_position_id(positions, noble)
noble = noble:upper()
for _,position in ipairs(positions.own) do
if position.code == noble then return position.id end
end
end

local function get_assigned_noble_unit(positions, noble_position_id)
for _,assignment in ipairs(positions.assignments) do
if assignment.position_id == noble_position_id then
local histfig = df.historical_figure.find(assignment.histfig)
if not histfig then return end
return df.unit.find(histfig.unit_id)
end
end
end

local function get_noble_unit(noble)
local site = df.global.world.world_data.active_site[0]
for _,entity_site_link in ipairs(site.entity_links) do
local gov = df.historical_entity.find(entity_site_link.entity_id)
if not gov or gov.type ~= df.historical_entity_type.SiteGovernment then goto continue end
local noble_position_id = get_noble_position_id(gov.positions, noble)
if not noble_position_id then
dfhack.printerr(('could not find a noble position for: "%s"'):format(noble))
return
else
return get_assigned_noble_unit(gov.positions, noble_position_id)
end
::continue::
end
local unit = dfhack.units.getUnitByNobleRole(noble)
if not unit then log('could not find a noble position for: "%s"', noble) end
return unit
end

local function parse_zone_config(c, props)
Expand Down

0 comments on commit 64aff9c

Please sign in to comment.