Skip to content

Commit

Permalink
[MIRROR] [NO GBP] Fixes critical storage issues [MDB IGNORE] (#4128)
Browse files Browse the repository at this point in the history
* [NO GBP] Fixes critical storage issues (#84449)

Closes #84447
Closes #84445

Fixes incorrect assoc list deletion, storage deletion order and some
math oopsies

:cl:
fix: Storage no longer deletes all of its viewers upon being deleted
fix: Storage UI now renders properly
/:cl:

* [NO GBP] Fixes critical storage issues

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: SmArtKar <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
Co-authored-by: Iajret <[email protected]>
  • Loading branch information
5 people authored Jun 29, 2024
1 parent 7ad332c commit 02a8e9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 5 additions & 3 deletions code/datums/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@
src.max_total_storage = max_total_storage

/datum/storage/Destroy()
parent = null
real_location = null

for(var/mob/person in is_using)
hide_contents(person)

is_using.Cut()
QDEL_LAZYLIST(storage_interfaces)
QDEL_LIST_ASSOC_VAL(storage_interfaces)

parent = null
real_location = null

return ..()

Expand Down Expand Up @@ -1036,6 +1037,7 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
to_hide.client.screen -= storage_interfaces[to_hide].list_ui_elements()
to_hide.client.screen -= real_location.contents
QDEL_NULL(storage_interfaces[to_hide])
storage_interfaces -= to_hide

return TRUE

Expand Down
13 changes: 7 additions & 6 deletions code/datums/storage/storage_interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,19 @@
var/end_pixel_y = start_pixel_y + (rows - 1) * 32

cells.screen_loc = spanning_screen_loc(start_pixel_x, start_pixel_y, end_pixel_x, end_pixel_y)
var/left_edge_loc = spanning_screen_loc(start_pixel_x + 32, start_pixel_y, end_pixel_x, end_pixel_y)
var/right_edge_loc = spanning_screen_loc(start_pixel_x, start_pixel_y, end_pixel_x + max(0, (columns - 2)) * 32, end_pixel_y)
var/left_edge_loc = spanning_screen_loc(min(start_pixel_x + 32, end_pixel_x), start_pixel_y, end_pixel_x, end_pixel_y)
var/right_edge_loc = spanning_screen_loc(start_pixel_x, start_pixel_y, max(start_pixel_x, end_pixel_x - 32), end_pixel_y)
corner_top_left.screen_loc = left_edge_loc
corner_top_right.screen_loc = right_edge_loc
corner_bottom_left.screen_loc = left_edge_loc
corner_top_right.screen_loc = right_edge_loc
corner_bottom_right.screen_loc = right_edge_loc

var/row_loc = spanning_screen_loc(start_pixel_x, start_pixel_y + 27, end_pixel_x, end_pixel_y + 27 + max(0, rows - 2) * 32)
rowjoin_left.screen_loc = row_loc
var/row_left_loc = spanning_screen_loc(start_pixel_x, start_pixel_y + 27, start_pixel_x, start_pixel_y + 27 + max(0, rows - 2) * 32)
rowjoin_left.screen_loc = row_left_loc
rowjoin_left.alpha = (rows > 1) * 255

rowjoin_right.screen_loc = row_loc
var/row_right_loc = spanning_screen_loc(end_pixel_x, start_pixel_y + 27, end_pixel_x, start_pixel_y + 27 + max(0, rows - 2) * 32)
rowjoin_right.screen_loc = row_right_loc
rowjoin_right.alpha = (rows > 1) * 255

closer.screen_loc = "[screen_start_x + columns]:[screen_pixel_x - 5],[screen_start_y]:[screen_pixel_y]"

0 comments on commit 02a8e9f

Please sign in to comment.