From c7133a17a7588a80634ca2a645f8227eebf82c7c Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Sun, 13 May 2012 22:14:53 -0700 Subject: [PATCH] Adds runtime detection to the atmos ticker. 20 ticks of runtimes, total, will kill atmos. --- code/FEA/FEA_system.dm | 70 +++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/code/FEA/FEA_system.dm b/code/FEA/FEA_system.dm index 40c447c6b0..31c46503d2 100644 --- a/code/FEA/FEA_system.dm +++ b/code/FEA/FEA_system.dm @@ -104,6 +104,7 @@ datum var/current_cycle = 0 var/update_delay = 5 //How long between check should it try to process atmos again. + var/failed_ticks = 0 //How many ticks have runtimed? /* process() @@ -211,39 +212,52 @@ datum set background = 1 while(1) - if(kill_air) - return 1 - current_cycle++ - if(groups_to_rebuild.len > 0) //If there are groups to rebuild, do so. - spawn process_rebuild_select_groups() + if(!kill_air) + current_cycle++ + var/success = tick() //Changed so that a runtime does not crash the ticker. + if(!success) //Runtimed. + failed_ticks++ + if(failed_ticks > 20) + world << "ERROR IN ATMOS TICKER. Killing air simulation!" + kill_air = 1 + sleep(max(5,update_delay*tick_multiplier)) - if(tiles_to_update.len > 0) //If there are tiles to update, do so. - for(var/turf/simulated/T in tiles_to_update) - spawn T.update_air_properties() - tiles_to_update = list() + proc/tick() + if(groups_to_rebuild.len > 0) //If there are groups to rebuild, do so. + spawn process_rebuild_select_groups() - for(var/datum/air_group/AG in air_groups) //Processing groups + if(tiles_to_update.len > 0) //If there are tiles to update, do so. + for(var/turf/simulated/T in tiles_to_update) + spawn T.update_air_properties() + tiles_to_update = list() + + for(var/datum/air_group/AG in air_groups) //Processing groups + spawn + if(AG) // Because of runtime errors on syphoning. + AG.process_group() + + for(var/turf/simulated/T in active_singletons) //Processing Singletons + spawn + if(istype(T)) + T.process_cell() + else + active_singletons.Remove(T) + + for(var/turf/simulated/hot_potato in active_super_conductivity) //Process superconduction + spawn hot_potato.super_conduct() + + if(high_pressure_delta.len) //Process high pressure delta (airflow) + for(var/turf/pressurized in high_pressure_delta) + spawn pressurized.high_pressure_movements() + high_pressure_delta = list() + + if(current_cycle%10==5) //Check for groups of tiles to resume group processing every 10 cycles + for(var/datum/air_group/AG in air_groups) spawn if(AG) // Because of runtime errors on syphoning. - AG.process_group() + AG.check_regroup() + return 1 - for(var/turf/simulated/T in active_singletons) //Processing Singletons - spawn T.process_cell() - - for(var/turf/simulated/hot_potato in active_super_conductivity) //Process superconduction - spawn hot_potato.super_conduct() - - if(high_pressure_delta.len) //Process high pressure delta (airflow) - for(var/turf/pressurized in high_pressure_delta) - spawn pressurized.high_pressure_movements() - high_pressure_delta = list() - - if(current_cycle%10==5) //Check for groups of tiles to resume group processing every 10 cycles - for(var/datum/air_group/AG in air_groups) - spawn - if(AG) // Because of runtime errors on syphoning. - AG.check_regroup() - sleep(max(5,update_delay*tick_multiplier)) proc/process_rebuild_select_groups() //Purpose: This gets called to recalculate and rebuild group geometry