Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turn EncodeDNABlock proc into a define #28186

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@
#define DNA_GENDER_FEMALE 0
#define DNA_GENDER_MALE 1
#define DNA_GENDER_PLURAL 2

#define ENCODE_DNA_BLOCK(value) num2hex(value, 3)
12 changes: 4 additions & 8 deletions code/game/dna/dna2.dm
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)

// Get a hex-encoded UI block.
/datum/dna/proc/GetUIBlock(block)
return EncodeDNABlock(GetUIValue(block))
return ENCODE_DNA_BLOCK(GetUIValue(block))

// Do not use this unless you absolutely have to.
// Set a block from a hex string. This is inefficient. If you can, use SetUIValue().
Expand Down Expand Up @@ -352,7 +352,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)

// Get hex-encoded SE block.
/datum/dna/proc/GetSEBlock(block)
return EncodeDNABlock(GetSEValue(block))
return ENCODE_DNA_BLOCK(GetSEValue(block))

// Do not use this unless you absolutely have to.
// Set a block from a hex string. This is inefficient. If you can, use SetUIValue().
Expand Down Expand Up @@ -383,15 +383,11 @@ GLOBAL_LIST_EMPTY(bad_blocks)
//testing("SetSESubBlock([block],[subBlock],[newSubBlock],[defer]): [oldBlock] -> [newBlock]")
SetSEBlock(block, newBlock, defer)


/proc/EncodeDNABlock(value)
return num2hex(value, 3)

/datum/dna/proc/UpdateUI()
var/list/ui_text_list = list()
uni_identity = ""
for(var/block in UI)
ui_text_list += EncodeDNABlock(block)
ui_text_list += ENCODE_DNA_BLOCK(block)
uni_identity = ui_text_list.Join("")
//testing("New UI: [uni_identity]")
dirtyUI = 0
Expand All @@ -401,7 +397,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)
var/list/se_text_list = list()
struc_enzymes = ""
for(var/block in SE)
se_text_list += EncodeDNABlock(block)
se_text_list += ENCODE_DNA_BLOCK(block)
struc_enzymes = se_text_list.Join("")
//testing("Old SE: [oldse]")
//testing("New SE: [struc_enzymes]")
Expand Down
2 changes: 1 addition & 1 deletion code/game/dna/dna_modifier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
/obj/machinery/computer/scan_consolenew/proc/all_dna_blocks(list/buffer)
var/list/arr = list()
for(var/i = 1, i <= length(buffer), i++)
arr += "[i]:[EncodeDNABlock(buffer[i])]"
arr += "[i]:[ENCODE_DNA_BLOCK(buffer[i])]"
return arr

/obj/machinery/computer/scan_consolenew/proc/setInjectorBlock(obj/item/dnainjector/I, blk, datum/dna2/record/buffer)
Expand Down