From 232fb90388225c8d2c7fc351367f163d5daa6da1 Mon Sep 17 00:00:00 2001 From: Timberpoes Date: Fri, 9 Apr 2021 10:31:45 +0100 Subject: [PATCH] Cleanup (#58234) as x doesn't work properly when used in for loops over special lists. One instance of as anything in get_turf() in crafting code was removed as entirely redundant. It was an untyped for loop anyway. Two instances of as anything in contents changed for wheelchairs with warnings added to change them to as anything loops when we upgrade to 514. --- code/datums/components/crafting/crafting.dm | 2 +- code/modules/vehicles/motorized_wheelchair.dm | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index d8a62b693a9..04c2d57a6ed 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -196,7 +196,7 @@ if(check_contents(a, R, contents)) if(check_tools(a, R, contents)) if(R.one_per_turf) - for(var/content as anything in get_turf(a)) + for(var/content in get_turf(a)) if(istype(content, R.result)) return ", object already present." //If we're a mob we'll try a do_after; non mobs will instead instantly construct the item diff --git a/code/modules/vehicles/motorized_wheelchair.dm b/code/modules/vehicles/motorized_wheelchair.dm index 104c094f052..9b7b3c72745 100644 --- a/code/modules/vehicles/motorized_wheelchair.dm +++ b/code/modules/vehicles/motorized_wheelchair.dm @@ -39,8 +39,12 @@ /obj/vehicle/ridden/wheelchair/motorized/obj_destruction(damage_flag) var/turf/T = get_turf(src) - for(var/atom/movable/thing as anything in contents) - thing.forceMove(T) +#if MIN_COMPILER_VERSION >= 514 + #warn Please replace the loop below this warning with an `as anything` loop. +#endif + for(var/wheelchair_content in contents) + var/atom/movable/atom_content = wheelchair_content + atom_content.forceMove(T) return ..() /obj/vehicle/ridden/wheelchair/motorized/relaymove(mob/living/user, direction) @@ -116,8 +120,12 @@ new /obj/item/stack/rods(drop_location(), 8) new /obj/item/stack/sheet/iron(drop_location(), 10) var/turf/T = get_turf(src) - for(var/atom/movable/thing as anything in contents) - thing.forceMove(T) +#if MIN_COMPILER_VERSION >= 514 + #warn Please replace the loop below this warning with an `as anything` loop. +#endif + for(var/wheelchair_content in contents) + var/atom/movable/atom_content = wheelchair_content + atom_content.forceMove(T) qdel(src) return TRUE