Skip to content

Commit

Permalink
race condition
Browse files Browse the repository at this point in the history
fixes a race-condition induced issue and also improves perf a tiny bit.
  • Loading branch information
DeltaFire15 committed Aug 23, 2024
1 parent d7f3a63 commit 1614aeb
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions nsv13/code/controllers/subsystem/overmap_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ SUBSYSTEM_DEF(overmap_mode)
var/list/modes
var/list/mode_names

///Have we already handed people the base achievement this round?
var/patrol_achievement_base_granted = FALSE
///Have we already handed people the extended patrol achievement this round?
var/patrol_achievement_adv_granted = FALSE

/datum/controller/subsystem/overmap_mode/Initialize(start_timeofday)
//Retrieve the list of modes
//Check our map for any white/black lists
Expand Down Expand Up @@ -459,22 +464,27 @@ SUBSYSTEM_DEF(overmap_mode)
mode.winner = F //This should allow the mode to finish up by itself
mode.check_finished()
if((objective_check >= objective_length) && !failed)
for(var/mob/living/living_mob in GLOB.mob_living_list)
if(!living_mob.job)
continue
var/datum/job/job_ref = SSjob.GetJob(living_mob.job)
if(!job_ref)
continue
if(job_ref.faction != "Station")
continue
if(!living_mob.client)
continue
var/achievement_type
if(!SSovermap_mode.round_extended)
var/achievement_type
if(!SSovermap_mode.round_extended)
if(!SSovermap_mode.patrol_achievement_base_granted)
achievement_type = /datum/award/achievement/misc/crew_competent
else
SSovermap_mode.patrol_achievement_base_granted = TRUE
else
if(!SSovermap_mode.patrol_achievement_adv_granted)
achievement_type = /datum/award/achievement/misc/crew_very_competent
living_mob.client.give_award(achievement_type, living_mob)
SSovermap_mode.patrol_achievement_adv_granted = TRUE
if(achievement_type)
for(var/mob/living/living_mob in GLOB.mob_living_list)
if(!living_mob.job)
continue
var/datum/job/job_ref = SSjob.GetJob(living_mob.job)
if(!job_ref)
continue
if(job_ref.faction != "Station")
continue
if(!living_mob.client)
continue
living_mob.client.give_award(achievement_type, living_mob)
victory()

/datum/overmap_gamemode/proc/victory()
Expand Down

0 comments on commit 1614aeb

Please sign in to comment.