Replaced the critter AI recursion with a proper loop, this seems to have fixed profiling.

This commit is contained in:
cib
2012-05-04 08:25:31 -07:00
parent d4b9204316
commit 0d97f6c327

View File

@@ -8,6 +8,10 @@
process()
set background = 1
if (!src.alive) return
// use a loop to avoid weird benchmarking phenomenons caused by
// recursion
while(1)
switch(task)
if("thinking")
src.attack = 0
@@ -80,9 +84,7 @@
icon_state = initial(icon_state)
patrol_step()
sleep(wanderspeed)
spawn(8)
process()
return
sleep(8)
patrol_step()