mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Switches hacky list copying method in check_items and check_fruit to use Copy(). Uses Cut() to make sure that one item does not satisfy the need for multiple items of the same type.
This commit is contained in:
@@ -54,8 +54,8 @@
|
|||||||
. = 1
|
. = 1
|
||||||
if(fruit && fruit.len)
|
if(fruit && fruit.len)
|
||||||
var/list/checklist = list()
|
var/list/checklist = list()
|
||||||
for(var/fruittype in fruit) // I do not trust Copy().
|
// You should trust Copy().
|
||||||
checklist[fruittype] = fruit[fruittype]
|
checklist = fruit.Copy()
|
||||||
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in container)
|
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in container)
|
||||||
if(!G.seed || !G.seed.kitchen_tag || isnull(checklist[G.seed.kitchen_tag]))
|
if(!G.seed || !G.seed.kitchen_tag || isnull(checklist[G.seed.kitchen_tag]))
|
||||||
continue
|
continue
|
||||||
@@ -73,15 +73,15 @@
|
|||||||
. = 1
|
. = 1
|
||||||
if (items && items.len)
|
if (items && items.len)
|
||||||
var/list/checklist = list()
|
var/list/checklist = list()
|
||||||
for(var/item_type in items)
|
checklist = items.Copy() // You should really trust Copy
|
||||||
checklist |= item_type //Still don't trust Copy().
|
|
||||||
for(var/obj/O in container)
|
for(var/obj/O in container)
|
||||||
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/grown))
|
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/grown))
|
||||||
continue // Fruit is handled in check_fruit().
|
continue // Fruit is handled in check_fruit().
|
||||||
var/found = 0
|
var/found = 0
|
||||||
for(var/item_type in checklist)
|
for(var/i = 1; i < checklist.len+1; i++)
|
||||||
|
var/item_type = checklist[i]
|
||||||
if (istype(O,item_type))
|
if (istype(O,item_type))
|
||||||
checklist-=item_type
|
checklist.Cut(i, i+1)
|
||||||
found = 1
|
found = 1
|
||||||
break
|
break
|
||||||
if (!found)
|
if (!found)
|
||||||
|
|||||||
Reference in New Issue
Block a user