From e05d4c14f81814cada07225235e20494a73cf7d9 Mon Sep 17 00:00:00 2001 From: Ldip999 <60290575+Ldip999@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:29:41 +0200 Subject: [PATCH] Fixes supply tgui bluescreen (#16293) --- code/modules/reqs/supply.dm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/modules/reqs/supply.dm b/code/modules/reqs/supply.dm index b718fe6370657..bde4c3dfc95e2 100644 --- a/code/modules/reqs/supply.dm +++ b/code/modules/reqs/supply.dm @@ -375,9 +375,15 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list( var/datum/supply_order/SO = LAZYACCESSASSOC(SSpoints.shoppinglist, faction, key) .["awaiting_delivery_orders"]++ var/list/packs = list() - for(var/datum/supply_packs/SP AS in SO.pack) - packs += SP.type - .["awaiting_delivery"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "packs" = packs, "authed_by" = SO.authorised_by)) + var/cost = 0 + for(var/P in SO.pack) + var/datum/supply_packs/SP = P + if(packs[SP.type]) + packs[SP.type] += 1 + else + packs[SP.type] = 1 + cost += SP.cost + .["awaiting_delivery"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by)) .["export_history"] = list() var/id = 0 var/lastexport = "" @@ -401,7 +407,10 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list( var/cost = 0 for(var/P in SO.pack) var/datum/supply_packs/SP = P - packs += SP.type + if(packs[SP.type]) + packs[SP.type] += 1 + else + packs[SP.type] = 1 cost += SP.cost .["shopping_history"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by)) .["shopping_list_cost"] = 0