Skip to content

caravan: fix doubled pending value and lost marks across filter views - #1620

Open
Alistair-Afton wants to merge 1 commit into
DFHack:masterfrom
Alistair-Afton:fix-movegoods-value
Open

Alistair-Afton wants to merge 1 commit into
DFHack:masterfrom
Alistair-Afton:fix-movegoods-value

Conversation

@Alistair-Afton

Copy link
Copy Markdown

Summary

Fixes DFHack/dfhack#5829

The movegoods overlay caches a separate copy of choice state for each filter combination (grouped x inside containers). Rebuilding a combination added all selected values to the pending total again, which doubled the displayed "total value of items marked for trade". Marks made in one view were also invisible in the others, and dismissing the modal only committed the currently active view, so marks were silently lost.

Marked state is now a shared set of explicit user decisions on the widget. Each cached view derives its pending flags from it, the pending total is recomputed once per scan, and dismiss commits every explicit mark regardless of the active view.

Testing

In game with a fort and trade depot: instantiated the modal and exercised all four filter combinations. The pending total stays constant instead of doubling. Marks made in the ungrouped view remain visible in the grouped and inside containers views, and dismissing while viewing a different filter still creates the BringItemToDepot job. Unmarking and remarking adjusts the total correctly, and icons update on toggled items.

Each "bring goods to depot" filter combination (grouped x inside
containers) cached its own copy of choice state. Rebuilding a combo
added the selected values to the pending total again, doubling the
displayed value, and marks made in one view were invisible in the
others, so dismissing the modal silently dropped them.

Keep a shared set of explicit marks on the MoveGoods widget, derive
each cached view's pending flags from it, recompute the pending total
once per scan instead of accumulating it, and commit every explicit
mark on dismiss regardless of which view is active.
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.

Minor visual bug in caravan movegoods interface

1 participant