From a04ac32b097a1f2ae13a744b496b4894371506f0 Mon Sep 17 00:00:00 2001 From: DGamerL <108773801+DGamerL@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:32:48 +0200 Subject: [PATCH] Makes our codebase 1641 ready (#26151) * Makes our codebase 1641 ready * Store variable * Renames var --- code/datums/components/_component.dm | 18 +++++++++--------- code/datums/datumvars.dm | 5 +++-- code/game/objects/items/weapons/AI_modules.dm | 12 ++++++------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index fffa11ef74d..cbf6e6940e7 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -343,17 +343,17 @@ */ /datum/proc/GetExactComponent(datum/component/c_type) RETURN_TYPE(c_type) - if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED || initial(c_type.dupe_mode) == COMPONENT_DUPE_SELECTIVE) + var/initial_type_mode = initial(c_type.dupe_mode) + if(initial_type_mode == COMPONENT_DUPE_ALLOWED || initial_type_mode == COMPONENT_DUPE_SELECTIVE) stack_trace("GetComponent was called to get a component of which multiple copies could be on an object. This can easily break and should be changed. Type: \[[c_type]\]") - var/list/dc = datum_components - if(!dc) + var/list/all_components = datum_components + if(!all_components) return null - var/datum/component/C = dc[c_type] - if(C) - if(length(C)) - C = C[1] - if(C.type == c_type) - return C + var/datum/component/potential_component + if(length(all_components)) + potential_component = all_components[c_type] + if(potential_component?.type == c_type) + return potential_component return null /** diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 95f53268c90..a7d7fb33062 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -463,11 +463,12 @@ var/header if(DA) if(islist(DA)) + var/list/debug_list = DA var/index = name if(value) - name = DA[name] // name is really the index until this line + name = debug_list[name] // name is really the index until this line else - value = DA[name] + value = debug_list[name] header = "