mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-24 05:38:15 +01:00
Little Weakref Refactor
This commit is contained in:
committed by
CHOMPStation2
parent
515d0e49ba
commit
3d53d2bb62
@@ -21,7 +21,7 @@ D [1]/ ||
|
||||
/datum/integrated_io
|
||||
var/name = "input/output"
|
||||
var/obj/item/integrated_circuit/holder = null
|
||||
var/weakref/data = null // This is a weakref, to reduce typecasts. Note that oftentimes numbers and text may also occupy this.
|
||||
var/datum/weakref/data = null // This is a weakref, to reduce typecasts. Note that oftentimes numbers and text may also occupy this.
|
||||
var/list/linked = list()
|
||||
var/io_type = DATA_CHANNEL
|
||||
|
||||
@@ -47,7 +47,7 @@ D [1]/ ||
|
||||
/datum/integrated_io/proc/data_as_type(var/as_type)
|
||||
if(!isweakref(data))
|
||||
return
|
||||
var/weakref/w = data
|
||||
var/datum/weakref/w = data
|
||||
var/output = w.resolve()
|
||||
return istype(output, as_type) ? output : null
|
||||
|
||||
@@ -82,7 +82,7 @@ list[](
|
||||
return result
|
||||
|
||||
if(isweakref(input))
|
||||
var/weakref/w = input
|
||||
var/datum/weakref/w = input
|
||||
var/atom/A = w.resolve()
|
||||
//return A ? "([A.name] \[Ref\])" : "(null)" // For refs, we want just the name displayed.
|
||||
return A ? "(\ref[A] \[Ref\])" : "(null)"
|
||||
|
||||
Reference in New Issue
Block a user