[MIRROR] Makes the ChangeTurf same turf optimization work properly again, and converts baseturfs into a string_list (#1601)

* Makes the ChangeTurf same turf optimization work properly again, and converts baseturfs into a string_list (#54277)

I've converted baseturfs into a string list, I had to add a helper proc for baseturf stringlistifying, as the system expects single length baseturfs to not be a list, and I needed to support that. I added a length check of 100 to the helper proc, to help prevent more stuff like what got us into this mess in the first place, the kilo oom bug.

Makes ChangeTurf a lot faster in some cases, as it should be, and saves a lot of memory with cached lists.

* Makes the ChangeTurf same turf optimization work properly again, and converts baseturfs into a string_list

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-11-07 05:06:11 +00:00
committed by GitHub
co-authored by LemonInTheDark
parent 5d2c3da593
commit 7813465ef3
6 changed files with 39 additions and 19 deletions
+3 -2
View File
@@ -34,11 +34,12 @@
qdel(src)
/obj/effect/baseturf_helper/proc/replace_baseturf(turf/thing)
var/list/baseturf_cache = thing.baseturfs
if(length(baseturf_cache))
if(length(thing.baseturfs))
var/list/baseturf_cache = thing.baseturfs.Copy()
for(var/i in baseturf_cache)
if(baseturf_to_replace[i])
baseturf_cache -= i
thing.baseturfs = baseturfs_string_list(baseturf_cache, thing)
if(!baseturf_cache.len)
thing.assemble_baseturfs(baseturf)
else