DNA2 Bug Fixes - Part 2 (CHERRY PICK)

We discovered that most of the problems were were having was because of BYOND passing lists (e.g. SE and UI) by-ref instead of the assumed by-val.

This commit adds dna.Clone() and (UI|SE).Copy() where needed.  These should be used where DNA or SE/UI lists are COPIED, otherwise changes made in the reference will affect the real strand.

This change also messes with the gene activation logic.

Conflicts:
	code/game/dna/dna2_domutcheck.dm
	code/game/dna/genes/powers.dm
This commit is contained in:
Rob Nelson
2014-02-06 23:07:35 -08:00
committed by Ccomp5950
parent 1088888791
commit fa20b9c2ee
22 changed files with 240 additions and 414 deletions

View File

@@ -39,12 +39,14 @@
//Save original dna for when the disease is cured.
src.original_dna["name"] = affected_mob.real_name
src.original_dna["UI"] = affected_mob.dna.UI
src.original_dna["SE"] = affected_mob.dna.SE
src.original_dna["UI"] = affected_mob.dna.UI.Copy()
src.original_dna["SE"] = affected_mob.dna.SE.Copy()
affected_mob << "\red You don't feel like yourself.."
affected_mob.UpdateAppearance(strain_data["UI"])
affected_mob.dna.SE = strain_data["SE"]
var/list/newUI=strain_data["UI"]
var/list/newSE=strain_data["SE"]
affected_mob.UpdateAppearance(newUI.Copy())
affected_mob.dna.SE = newSE.Copy()
affected_mob.dna.UpdateSE()
affected_mob.real_name = strain_data["name"]
domutcheck(affected_mob)
@@ -56,8 +58,10 @@
/datum/disease/dnaspread/Del()
if ((original_dna["name"]) && (original_dna["UI"]) && (original_dna["SE"]))
affected_mob.UpdateAppearance(original_dna["UI"])
affected_mob.dna.SE = original_dna["SE"]
var/list/newUI=original_dna["UI"]
var/list/newSE=original_dna["SE"]
affected_mob.UpdateAppearance(newUI.Copy())
affected_mob.dna.SE = newSE.Copy()
affected_mob.dna.UpdateSE()
affected_mob.real_name = original_dna["name"]