Skip to content

Issue #5751 - gui/siegemanager - cleaner error logging if no siege engine selected#1568

Open
Halavus wants to merge 2 commits intoDFHack:masterfrom
Halavus:siegemanager-fix-issue#5751
Open

Issue #5751 - gui/siegemanager - cleaner error logging if no siege engine selected#1568
Halavus wants to merge 2 commits intoDFHack:masterfrom
Halavus:siegemanager-fix-issue#5751

Conversation

@Halavus
Copy link
Contributor

@Halavus Halavus commented Mar 16, 2026

If this PR makes an externally-visible change in behavior, please add an appropriate line to changelog.txt.

@Halavus
Copy link
Contributor Author

Halavus commented Mar 16, 2026

pre-commit.ci autofix

Comment on lines +419 to +422
if not selected then
qerror('No siege engine selected')
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fundamentally the wrong way to fix the problem. All it does is change the error instead of avoiding it. The underlying issue is that the labels for setting the siege engines stance are enabled even if there is no siege engine selected. Thus, the right way to address this is to provide a function/callback that checks whether the labels should be enabled, as has been done here for example:

scripts/idle-crafting.lua

Lines 576 to 580 in 56c934e

enabled = function()
local bld = dfhack.gui.getSelectedBuilding(true)
if not bld then return end
return not invalidProfile(bld)
end,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants