mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 13:30:42 +01:00
Remove the datum pool (#2873)
Removes the datum pool. New-qdel is faster than pooling, and we didn't use it anyways.
This commit is contained in:
@@ -50,7 +50,6 @@
|
||||
#include "code\_helpers\area_movement.dm"
|
||||
#include "code\_helpers\areas.dm"
|
||||
#include "code\_helpers\atmospherics.dm"
|
||||
#include "code\_helpers\datum_pool.dm"
|
||||
#include "code\_helpers\files.dm"
|
||||
#include "code\_helpers\functional.dm"
|
||||
#include "code\_helpers\game.dm"
|
||||
|
||||
@@ -22,11 +22,6 @@
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/pipeline/resetVariables()
|
||||
..("members", "edges")
|
||||
members = list()
|
||||
edges = list()
|
||||
|
||||
/datum/pipeline/process()//This use to be called called from the pipe networks
|
||||
//Check to see if pressure is within acceptable limits
|
||||
var/pressure = air.return_pressure()
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define QDEL_HINT_HARDDEL_NOW 4 //qdel should assume this object won't gc, and hard del it post haste.
|
||||
#define QDEL_HINT_FINDREFERENCE 5 //functionally identical to QDEL_HINT_QUEUE if TESTING is not enabled in _compiler_options.dm.
|
||||
//if TESTING is enabled, qdel will call this object's find_references() verb.
|
||||
#define QDEL_HINT_POOL 6 //qdel should pool this object instead of deleting it.
|
||||
//defines for the gcDestroyed var
|
||||
|
||||
#define GC_QUEUED_FOR_QUEUING -1
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
//This was made pretty explicity for atmospherics devices which could not delete their datums properly
|
||||
//Make sure you go around and null out those references to the datum
|
||||
//It was also pretty explicitly and shamelessly stolen from regular object pooling, thanks esword
|
||||
|
||||
//#define DEBUG_DATUM_POOL
|
||||
|
||||
#define MAINTAINING_OBJECT_POOL_COUNT 500
|
||||
|
||||
// Read-only or compile-time vars and special exceptions.
|
||||
/var/list/exclude = list("inhand_states", "loc", "locs", "parent_type", "vars", "verbs", "type", "x", "y", "z","group", "animate_movement")
|
||||
|
||||
/var/global/list/masterdatumPool = new
|
||||
/var/global/list/pooledvariables = new
|
||||
|
||||
/*
|
||||
* @args : datum type, normal arguments
|
||||
* Example call: getFromPool(/datum/pipeline, args)
|
||||
*/
|
||||
/proc/getFromPool(var/type, ...)
|
||||
var/list/B = (args - type)
|
||||
|
||||
if(length(masterdatumPool[type]) <= 0)
|
||||
|
||||
#ifdef DEBUG_DATUM_POOL
|
||||
to_chat(world, text("DEBUG_DATUM_POOL: new proc has been called ([] | []).", type, list2params(B)))
|
||||
#endif
|
||||
|
||||
if(isnull(masterdatumPool[type]))
|
||||
masterdatumPool[type] = list()
|
||||
|
||||
if(B && B.len)
|
||||
return new type(arglist(B))
|
||||
else
|
||||
return new type()
|
||||
|
||||
var/datum/O = masterdatumPool[type][1]
|
||||
masterdatumPool[type] -= O
|
||||
|
||||
#ifdef DEBUG_DATUM_POOL
|
||||
to_chat(world, text("DEBUG_DATUM_POOL: getFromPool([]) [] left arglist([]).", type, length(masterdatumPool[type]), list2params(B)))
|
||||
#endif
|
||||
|
||||
if(!O || !istype(O))
|
||||
O = new type(arglist(B))
|
||||
else
|
||||
if(istype(O, /atom/movable) && B.len) // B.len check so we don't OoB.
|
||||
var/atom/movable/AM = O
|
||||
AM.forceMove(B[1], FALSE, TRUE)
|
||||
|
||||
if(B && B.len)
|
||||
O.New(arglist(B))
|
||||
else
|
||||
O.New()
|
||||
|
||||
return O
|
||||
|
||||
/*
|
||||
* @args
|
||||
* D, datum instance
|
||||
*
|
||||
* Example call: returnToPool(src)
|
||||
*/
|
||||
|
||||
/proc/returnToPool(const/datum/D)
|
||||
ASSERT(D)
|
||||
|
||||
if(istype(D, /atom/movable) && length(masterdatumPool[D.type]) > MAINTAINING_OBJECT_POOL_COUNT)
|
||||
#ifdef DEBUG_DATUM_POOL
|
||||
to_chat(world, text("DEBUG_DATUM_POOL: returnToPool([]) exceeds [] discarding...", D.type, MAINTAINING_OBJECT_POOL_COUNT))
|
||||
#endif
|
||||
|
||||
qdel(D, force = TRUE)
|
||||
return
|
||||
|
||||
if(isnull(masterdatumPool[D.type]))
|
||||
masterdatumPool[D.type] = list()
|
||||
|
||||
D.Destroy()
|
||||
D.resetVariables()
|
||||
|
||||
#ifdef DEBUG_DATUM_POOL
|
||||
if(D in masterdatumPool[D.type])
|
||||
to_chat(world, text("returnToPool has been called twice for the same datum of type [] time to panic.", D.type))
|
||||
#endif
|
||||
|
||||
masterdatumPool[D.type] |= D
|
||||
|
||||
#ifdef DEBUG_DATUM_POOL
|
||||
to_chat(world, text("DEBUG_DATUM_POOL: returnToPool([]) [] left.", D.type, length(masterdatumPool[D.type])))
|
||||
#endif
|
||||
|
||||
#undef MAINTAINING_DATUM_POOL_COUNT
|
||||
|
||||
#ifdef DEBUG_DATUM_POOL
|
||||
#undef DEBUG_DATUM_POOL
|
||||
#endif
|
||||
|
||||
/datum/proc/createVariables()
|
||||
pooledvariables[type] = new/list()
|
||||
var/list/exclude = global.exclude + args
|
||||
|
||||
for(var/key in vars)
|
||||
if(key in exclude)
|
||||
continue
|
||||
pooledvariables[type][key] = initial(vars[key])
|
||||
|
||||
//RETURNS NULL WHEN INITIALIZED AS A LIST() AND POSSIBLY OTHER DISCRIMINATORS
|
||||
//IF YOU ARE USING SPECIAL VARIABLES SUCH A LIST() INITIALIZE THEM USING RESET VARIABLES
|
||||
//SEE http://www.byond.com/forum/?post=76850 AS A REFERENCE ON THIS
|
||||
|
||||
/datum/proc/resetVariables()
|
||||
if(!pooledvariables[type])
|
||||
createVariables(args)
|
||||
|
||||
for(var/key in pooledvariables[type])
|
||||
vars[key] = pooledvariables[type][key]
|
||||
|
||||
/proc/isInTypes(atom/Object, types)
|
||||
if(!Object)
|
||||
return 0
|
||||
var/prototype = Object.type
|
||||
Object = null
|
||||
|
||||
for (var/type in params2list(types))
|
||||
if (ispath(prototype, text2path(type)))
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
/client/proc/debug_pooling()
|
||||
set name = "Debug Pooling Type"
|
||||
set category = "Debug"
|
||||
|
||||
if (!check_rights(R_DEBUG))
|
||||
return
|
||||
|
||||
if (!LAZYLEN(pooledvariables))
|
||||
usr << "No objects have been added to the datum pool."
|
||||
return
|
||||
|
||||
var/type = input("What is the typepath for the pooled object variables you wish to view?", "Pooled Variables") in pooledvariables|null
|
||||
|
||||
if(!type)
|
||||
return
|
||||
|
||||
var/list/L = list()
|
||||
L += "<b>Stored Variables for Pooling for this type</b><br>"
|
||||
for(var/key in pooledvariables[type])
|
||||
if(pooledvariables[type][key])
|
||||
L += "<br>[key] = [pooledvariables[type][key]]"
|
||||
else
|
||||
L += "<br>[key] = null"
|
||||
usr << browse(jointext(L,""),"window=poolingvariablelogs")
|
||||
|
||||
// Shim - this method doesn't natively exist in this implementation.
|
||||
/proc/IsPooled(var/datum/D)
|
||||
return "[D.type]" in masterdatumPool
|
||||
@@ -23,10 +23,6 @@
|
||||
spell_holder.client.screen -= src
|
||||
spell_holder = null
|
||||
|
||||
/obj/screen/movable/spell_master/resetVariables(var/list/exclude = list())
|
||||
exclude += "spell_objects"
|
||||
..(exclude)
|
||||
|
||||
/obj/screen/movable/spell_master/MouseDrop()
|
||||
if(showing)
|
||||
return
|
||||
|
||||
@@ -215,21 +215,6 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage
|
||||
#ifdef TESTING
|
||||
D.find_references()
|
||||
#endif
|
||||
if (QDEL_HINT_POOL)
|
||||
if (!force)
|
||||
D.gcDestroyed = null
|
||||
returnToPool(D)
|
||||
return
|
||||
// Returning POOL after being told to force destroy
|
||||
// indicates the objects Destroy() does not respect force
|
||||
if(!SSgarbage.noforcerespect["[D.type]"])
|
||||
SSgarbage.noforcerespect["[D.type]"] = "[D.type]"
|
||||
testing("WARNING: [D.type] has been force deleted, but is \
|
||||
returning an immortal QDEL_HINT, indicating it does \
|
||||
not respect the force flag for qdel(). It has been \
|
||||
placed in the queue, further instances of this type \
|
||||
will also be queued.")
|
||||
SSgarbage.QueueForQueuing(D)
|
||||
else
|
||||
if(!SSgarbage.noqdelhint["[D.type]"])
|
||||
SSgarbage.noqdelhint["[D.type]"] = "[D.type]"
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
expansions = null
|
||||
return ..()
|
||||
|
||||
/obj/resetVariables(var/list/exclude = list())
|
||||
exclude += "expansions"
|
||||
..(exclude)
|
||||
//expansions = list()
|
||||
|
||||
/obj/proc/set_expansion(var/type, var/instance)
|
||||
LAZYINITLIST(expansions)
|
||||
if(expansions[type])
|
||||
|
||||
@@ -207,7 +207,6 @@ var/list/admin_verbs_debug = list(
|
||||
/client/proc/dsay,
|
||||
/client/proc/toggle_recursive_explosions,
|
||||
/client/proc/restart_sql,
|
||||
/client/proc/debug_pooling,
|
||||
/client/proc/fix_player_list,
|
||||
/client/proc/lighting_show_verbs,
|
||||
/client/proc/restart_controller,
|
||||
@@ -303,8 +302,7 @@ var/list/admin_verbs_hideable = list(
|
||||
/client/proc/roll_dices,
|
||||
/proc/possess,
|
||||
/proc/release,
|
||||
/client/proc/toggle_recursive_explosions,
|
||||
/client/proc/debug_pooling
|
||||
/client/proc/toggle_recursive_explosions
|
||||
)
|
||||
var/list/admin_verbs_mod = list(
|
||||
/client/proc/cmd_admin_pm_context, // right-click adminPM interface,
|
||||
|
||||
@@ -150,10 +150,5 @@
|
||||
L_PROF(loc, "overlay_forcemove")
|
||||
. = ..()
|
||||
|
||||
/atom/movable/lighting_overlay/resetVariables(...)
|
||||
color = LIGHTING_BASE_MATRIX
|
||||
|
||||
return ..("color")
|
||||
|
||||
/atom/movable/lighting_overlay/shuttle_move(turf/loc)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user