Code cleanup time!

This commit is contained in:
Couls
2019-04-27 20:42:31 -04:00
parent 39dd7c3f86
commit fff65f34ca
7 changed files with 14 additions and 43 deletions
-2
View File
@@ -3,8 +3,6 @@
// for /datum/var/datum_flags
#define DF_USE_TAG (1<<0)
#define DF_VAR_EDITED (1<<1)
#define DF_ISPROCESSING (1<<2)
//FLAGS BITMASK
#define STOPSPRESSUREDMAGE 1 //This flag is used on the flags variable for SUIT and HEAD items which stop pressure damage. Note that the flag 1 was previous used as ONBACK, so it is possible for some code to use (flags & 1) when checking if something can be put on your back. Replace this code with (inv_flags & SLOT_BACK) if you see it anywhere To successfully stop you taking all pressure damage you must have both a suit and head item with this flag.
+12 -8
View File
@@ -18,20 +18,24 @@ var/global/next_unique_datum_id = 1
// /client/var/tmp/unique_datum_id = null
/datum/proc/UID()
if(!unique_datum_id)
/datum/proc/UID(input)
if (input)
if(istype(input, /datum))
var/datum/thing = input
if(thing.datum_flags & DF_USE_TAG)
if(!thing.tag)
stack_trace("A ref was requested of an object with DF_USE_TAG set but no tag: [thing]")
thing.datum_flags &= ~DF_USE_TAG
else
return "\[[url_encode(thing.tag)]\]"
return "\ref[input]"
else if(!unique_datum_id)
var/tag_backup = tag
tag = null // Grab the raw ref, not the tag
unique_datum_id = "\ref[src]_[next_unique_datum_id++]"
tag = tag_backup
return unique_datum_id
/client/UID()
if(!unique_datum_id)
unique_datum_id = "\ref[src]_[next_unique_datum_id++]"
return unique_datum_id
/proc/locateUID(uid)
if(!istext(uid))
return null
+1 -15
View File
@@ -2028,18 +2028,4 @@ var/mob/dview/dview_mob = new
CRASH(msg)
/proc/pass()
return
// \ref behaviour got changed in 512 so this is necesary to replicate old behaviour.
// If it ever becomes necesary to get a more performant REF(), this lies here in wait
// #define REF(thing) (thing && istype(thing, /datum) && (thing:datum_flags & DF_USE_TAG) && thing:tag ? "[thing:tag]" : "\ref[thing]")
/proc/REF(input)
if(istype(input, /datum))
var/datum/thing = input
if(thing.datum_flags & DF_USE_TAG)
if(!thing.tag)
stack_trace("A ref was requested of an object with DF_USE_TAG set but no tag: [thing]")
thing.datum_flags &= ~DF_USE_TAG
else
return "\[[url_encode(thing.tag)]\]"
return "\ref[input]"
return
-6
View File
@@ -43,12 +43,6 @@
qdel(C, FALSE, TRUE)
dc.Cut()
var/list/focusers = src.focusers
if(focusers)
for(var/i in 1 to focusers.len)
var/mob/M = focusers[i]
M.set_focus(M)
var/list/lookup = comp_lookup
if(lookup)
for(var/sig in lookup)
-9
View File
@@ -8,14 +8,5 @@
/mob/proc/set_focus(datum/new_focus)
if(focus == new_focus)
return
if(new_focus)
if(!new_focus.focusers) //Set up the new focus
new_focus.focusers = list()
new_focus.focusers += src
if(focus)
focus.focusers -= src //Tell the old focus we're done with it
focus = new_focus
reset_perspective(focus) //Maybe this should be done manually? You figure it out, reader
+1 -1
View File
@@ -42,5 +42,5 @@
for(var/k in 1 to macro_set.len)
var/key = macro_set[k]
var/command = macro_set[key]
winset(src, "[setname]-[REF(key)]", "parent=[setname];name=[key];command=[command]")
winset(src, "[setname]-[UID(key)]", "parent=[setname];name=[key];command=[command]")
winset(src, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=default")
-2
View File
@@ -20,5 +20,3 @@
for(var/datum/light_source/L in light_sources)
L.source_atom.update_light()
return 1
/mob/dead/Initialize()
set_focus(src)