Fixes missing length check before pick()

This commit is contained in:
unknown
2014-07-08 16:12:55 -04:00
committed by ZomgPonies
parent d3cdb25ef3
commit 9a6e39fc58
+8 -5
View File
@@ -407,8 +407,8 @@ Note that amputating the affected organ does in fact remove the infection from t
owner.adjustToxLoss(1)
if(germ_level >= INFECTION_LEVEL_TWO && antibiotics < 5)
//spread the infection
var/datum/organ/internal/target_organ //make internal organs become infected one at a time instead of all at once
//spread the infection to internal organs
var/datum/organ/internal/target_organ = null //make internal organs become infected one at a time instead of all at once
for (var/datum/organ/internal/I in internal_organs)
if (I.germ_level > 0 && I.germ_level < min(germ_level, INFECTION_LEVEL_TWO)) //once the organ reaches whatever we can give it, or level two, switch to a different one
if (!target_organ || I.germ_level > target_organ.germ_level) //choose the organ with the highest germ_level
@@ -420,11 +420,14 @@ Note that amputating the affected organ does in fact remove the infection from t
for (var/datum/organ/internal/I in internal_organs)
if (I.germ_level < germ_level)
candidate_organs += I
target_organ = pick(candidate_organs)
if (candidate_organs.len)
target_organ = pick(candidate_organs)
target_organ.germ_level++
if (target_organ)
target_organ.germ_level++
if (children) //To child organs
//spread the infection to child and parent organs
if (children)
for (var/datum/organ/external/child in children)
if (child.germ_level < germ_level && !(child.status & ORGAN_ROBOT))
if (child.germ_level < INFECTION_LEVEL_ONE*2 || prob(30))