From 57cd223eb0de658c2cb8789b96001bde40f07d8a Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Mon, 4 Jan 2016 12:17:09 -0600 Subject: [PATCH] Fix contains proc to use a loop --- code/__HELPERS/unsorted.dm | 12 ++++++------ code/modules/tgui/states/deep_inventory.dm | 2 +- code/modules/tgui/states/notcontained.dm | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 416362c16fa..a4eec6dc868 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1232,10 +1232,10 @@ B --><-- A return L -/atom/proc/contains(var/atom/location) - if(!location) - return 0 - if(location == src) - return 1 - return contains(location.loc) +/atom/proc/contains(var/atom/A) + if(!A) + return 0 + for(var/atom/location = A.loc, location, location = location.loc); // Semicolon is for the empty statement. + if(location == src) + return 1 \ No newline at end of file diff --git a/code/modules/tgui/states/deep_inventory.dm b/code/modules/tgui/states/deep_inventory.dm index e250a80d51a..70f2a59992e 100644 --- a/code/modules/tgui/states/deep_inventory.dm +++ b/code/modules/tgui/states/deep_inventory.dm @@ -1,7 +1,7 @@ /** * tgui state: deep_inventory_state * - * Checks that the src_object is in the user's fist-level (backpack, webbing, etc) inventory. + * Checks that the src_object is in the user's deep (backpack, box, toolbox, etc) inventory. **/ /var/global/datum/ui_state/deep_inventory_state/deep_inventory_state = new() diff --git a/code/modules/tgui/states/notcontained.dm b/code/modules/tgui/states/notcontained.dm index 109bbd16932..0b6462fe331 100644 --- a/code/modules/tgui/states/notcontained.dm +++ b/code/modules/tgui/states/notcontained.dm @@ -15,7 +15,7 @@ return UI_CLOSE /mob/living/notcontained_can_use_topic(atom/src_object) - if(src in src_object.contents) + if(src_object.contains(src)) return UI_CLOSE // Close if we're inside it. return default_can_use_topic(src_object)