Skip to content

Commit

Permalink
Fix section update not resetting when it should
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharparam committed Dec 12, 2024
1 parent 09f52d7 commit c88dcd6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 2.4.4
Date: 2024-12-12
Bugfixes:
- Fix section not always updating its display properly when changing group.
---------------------------------------------------------------------------------------------------
Version: 2.4.3
Date: 2024-12-11
Graphics:
Expand Down
9 changes: 5 additions & 4 deletions src/scripts/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ local function handle_on_off(event)
state.status_label.caption = is_ghost and GHOST_STATUS_NAME or STATUS_NAMES[status] or DEFAULT_STATUS_NAME
end

---@type fun(state: UiState, reset: boolean)
---@type fun(state: UiState, reset: boolean, reset_section_index: integer?)
local update_signal_sections

---@type fun(state: UiState, signal_table: LuaGuiElement, reset: boolean?)
Expand Down Expand Up @@ -898,7 +898,7 @@ local function confirm_logistic_group(player_index, close)

update_cs_signals(state)
refresh_network_list(player, state)
update_signal_sections(state, false)
update_signal_sections(state, false, state.logistic_group_edit.section.index)

state.logistic_group_edit.confirmed = true

Expand Down Expand Up @@ -1465,7 +1465,8 @@ end

---@param state UiState
---@param reset boolean
update_signal_sections = function(state, reset)
---@param reset_section_index integer?
update_signal_sections = function(state, reset, reset_section_index)
if not state then return end

local container = state.section_container
Expand All @@ -1485,7 +1486,7 @@ update_signal_sections = function(state, reset)
local caption = create_logistic_section_caption(section)
section_entry.header.checkbox.state = active
section_entry.header.checkbox.caption = caption
update_signal_table(state, section_entry.signal_table, reset)
update_signal_table(state, section_entry.signal_table, reset or reset_section_index == section.index)
::continue::
end
end
Expand Down

0 comments on commit c88dcd6

Please sign in to comment.