Datum pool no longer creates a new object just for the sake of it when initializing pool lists.
Also bandaids an issue where water could be qdeled while being sprayed and reagents nulled, because someone calls spawn() qdel in new.
Datum pool now also adds excess pool objects on the trash pile instead of calling del directly.
This commit is contained in:
PsiOmegaDelta
2015-06-04 14:40:45 +02:00
parent 697a167799
commit 2373eb4bdd
2 changed files with 17 additions and 11 deletions

View File

@@ -29,7 +29,7 @@ var/global/list/GlobalPool = list()
if(!D) if(!D)
// So the GC knows we're pooling this type. // So the GC knows we're pooling this type.
if(!GlobalPool[get_type]) if(!GlobalPool[get_type])
GlobalPool[get_type] = list(new get_type) GlobalPool[get_type] = list()
if(islist(second_arg)) if(islist(second_arg))
return new get_type (arglist(second_arg)) return new get_type (arglist(second_arg))
else else
@@ -58,7 +58,10 @@ var/global/list/GlobalPool = list()
#ifdef DEBUG_ATOM_POOL #ifdef DEBUG_ATOM_POOL
world << text("DEBUG_DATUM_POOL: PlaceInPool([]) exceeds []. Discarding.", D.type, ATOM_POOL_COUNT) world << text("DEBUG_DATUM_POOL: PlaceInPool([]) exceeds []. Discarding.", D.type, ATOM_POOL_COUNT)
#endif #endif
del(D) if(garbage_collector)
garbage_collector.AddTrash(D)
else
del(D)
return return
if(D in GlobalPool[D.type]) if(D in GlobalPool[D.type])

View File

@@ -17,17 +17,20 @@
if(!target) if(!target)
return return
for(var/i = 1 to step_count) for(var/i = 1 to step_count)
if(!loc)
return
step_towards(src, target) step_towards(src, target)
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
reagents.touch_turf(T) if(T && reagents)
var/mob/M = locate() in T reagents.touch_turf(T)
if(M) var/mob/M = locate() in T
reagents.splash_mob(M, reagents.total_volume) if(M)
break reagents.splash_mob(M, reagents.total_volume)
for(var/atom/A in T) break
reagents.touch(A) for(var/atom/A in T)
if(T == get_turf(target)) reagents.touch(A)
break if(T == get_turf(target))
break
sleep(delay) sleep(delay)
sleep(10) sleep(10)
qdel(src) qdel(src)