Process machines optimized loop.

Conflicts:
	code/controllers/master_controller.dm
This commit is contained in:
ESwordTheCat
2014-04-19 19:02:45 -04:00
committed by ZomgPonies
parent dd1613f6c4
commit 38ad3b0584
+11 -28
View File
@@ -175,7 +175,7 @@ datum/controller/game_controller/proc/process()
//MACHINES
timer = world.timeofday
process_machines()
processMachines()
machines_cost = (world.timeofday - timer) / 10
sleep(breather_ticks)
@@ -258,36 +258,19 @@ datum/controller/game_controller/proc/process_diseases()
continue
active_diseases.Cut(i,i+1)
datum/controller/game_controller/proc/process_machines()
var/i = 1
while(i<=machines.len)
var/obj/machinery/Machine = machines[i]
if(Machine && Machine.loc)
last_thing_processed = Machine.type
if(Machine.process() != PROCESS_KILL)
if(Machine)
// if(Machine.use_power)
// Machine.auto_use_power()
/datum/controller/game_controller/proc/processMachines()
for (var/obj/machinery/Machinery in machines)
if (Machinery && Machinery.loc)
last_thing_processed = Machinery.type
if(Machinery.process() != PROCESS_KILL)
if (Machinery) // Why another check?
if (Machinery.use_power)
Machinery.auto_use_power()
i++
continue
machines.Cut(i,i+1)
i=1
while(i<=active_areas.len)
var/area/A = active_areas[i]
if(A.powerupdate)
A.powerupdate -= 1
for(var/obj/machinery/M in A)
if(M)
if(M.use_power)
M.auto_use_power()
if(A.apc.len)
i++
continue
active_areas.Cut(i,i+1)
machines = machines - Machinery
datum/controller/game_controller/proc/process_objects()
var/i = 1