Merge pull request #4588 from Citadel-Station-13/upstream-merge-33914

[MIRROR] Prevent infinite loops in orbit checks
This commit is contained in:
LetterJay
2017-12-30 05:05:30 -06:00
committed by GitHub
+6 -3
View File
@@ -33,7 +33,9 @@
orbiting = null
return ..()
/datum/orbit/proc/Check(turf/targetloc)
/datum/orbit/proc/Check(turf/targetloc, list/checked_already = list())
//Avoid infinite loops for people who end up orbiting themself through another orbiter
checked_already[src] = TRUE
if (!orbiter)
qdel(src)
return
@@ -55,9 +57,10 @@
lastloc = orbiter.loc
for(var/other_orbit in orbiter.orbiters)
var/datum/orbit/OO = other_orbit
if(OO == src)
//Skip if checked already
if(checked_already[OO])
continue
OO.Check(targetloc)
OO.Check(targetloc, checked_already)
/atom/movable/var/datum/orbit/orbiting = null
/atom/var/list/orbiters = null