Skip to content

Commit

Permalink
More performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Repede committed Jan 28, 2024
1 parent c3b929b commit ae4f078
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions code/ZAS/Controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Class Procs:
var/list/active_fire_zones = list()
var/list/active_hotspots = list()
var/list/active_edges = list()
var/list/zones_planet_temperature_to_update = list()

var/active_zones = 0
var/current_cycle = 0
Expand All @@ -87,11 +88,13 @@ Class Procs:
/datum/controller/subsystem/air/proc/add_zone(zone/z)
zones.Add(z)
z.name = "Zone [next_id++]"
zones_planet_temperature_to_update.Add(z) //YW Addition - planet temp
mark_zone_update(z)

/datum/controller/subsystem/air/proc/remove_zone(zone/z)
zones.Remove(z)
zones_to_update.Remove(z)
zones_planet_temperature_to_update.Remove(z) //YW Addition - planet temp

/datum/controller/subsystem/air/proc/air_blocked(turf/A, turf/B)
#ifdef ZASDBG
Expand Down
12 changes: 7 additions & 5 deletions code/controllers/subsystems/air.dm
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,18 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
/datum/controller/subsystem/air/proc/process_boiler_zones_to_update(resumed = 0)
if (!resumed)
//I have no idea what this is for yet
src.currentrun = zones.Copy()
src.currentrun = zones_planet_temperature_to_update.Copy()

var/list/currentrun = src.currentrun
while(currentrun.len)
var/zone/zone = currentrun[currentrun.len]
currentrun.len--
if(!zone.invalid)
var/turf/T = zone.contents[1]
if(is_station_temp_change_turf(T))
equalize_temperature_to_planet(T, zone, thermal_energy_change)
var/turf/T = pick(zone.contents)
if(!is_station_temp_change_turf(T))
zones_planet_temperature_to_update.Remove(zone) //Remove from the global list so we do not spend time going over it again
continue
equalize_temperature_to_planet(T, zone, thermal_energy_change)
if(MC_TICK_CHECK)
testing("boiler MC TICK CHECK")
return
Expand Down Expand Up @@ -324,7 +326,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
msg += "F [active_fire_zones.len] | "
msg += "H [active_hotspots.len] | "
msg += "Z [zones_to_update.len] "
msg += "B [zones.len] "
msg += "B [zones_planet_temperature_to_update.len] "
msg += "}"
..(msg.Join())

Expand Down

0 comments on commit ae4f078

Please sign in to comment.