From 8ae701bd014da42f4e954869add74edb8a7ea0f8 Mon Sep 17 00:00:00 2001 From: "johnsonmt88@gmail.com" Date: Thu, 2 Aug 2012 23:43:14 +0000 Subject: [PATCH] Fix for heads not getting assigned properly at round start. Well, hopefully a fix. I've tested it locally to make sure it still actually assigns jobs without any problems, and it should work but we wont know for sure until we get more people trying it out. Thanks to Tonberrytoby for correcting me and pretty much pinpointing the source of the problem. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4296 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/jobs/job_controller.dm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index c9f860c5085..ab30be498ee 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -111,16 +111,16 @@ var/global/datum/controller/occupations/job_master return - proc/FillHeadPosition() + proc/FillHeadPosition(var/command_position) + if(!command_position) return 0 for(var/level = 1 to 3) - for(var/command_position in command_positions) - var/datum/job/job = GetJob(command_position) - if(!job) continue - var/list/candidates = FindOccupationCandidates(job, level) - if(!candidates.len) continue - var/mob/new_player/candidate = pick(candidates) - if(AssignRole(candidate, command_position)) - return 1 + var/datum/job/job = GetJob(command_position) + if(!job) continue + var/list/candidates = FindOccupationCandidates(job, level) + if(!candidates.len) continue + var/mob/new_player/candidate = pick(candidates) + if(AssignRole(candidate, command_position)) + return 1 return 0 @@ -195,7 +195,8 @@ var/global/datum/controller/occupations/job_master //Select one head Debug("DO, Running Head Check") - FillHeadPosition() + for(var/i in command_positions) + FillHeadPosition(i) Debug("DO, Head Check end") //Check for an AI