why?
Code:
proc
gettype(n)
switch(n)
if(1)
return /turf/red
if(2)
return /turf/blue
if(3)
return /turf/green
if(4)
return /turf/orange
if(5)
return /turf/pink
if(6)
return /turf/yellow
mob/verb
readtotext()
var/savefile/f = new("world_fast.sav")
var/ff = file("test.txt")
f.ExportText("/", ff)
fillrand()
for(var/x = 1, x < 256, x ++)
for(var/y = 1, y < 256, y++)
var/n = rand(1,6)
var/typet = gettype(n)
new typet(locate(x,y,1))
clearworld()
for(var/turf/t in world)
del(t)
SaveWorld_Fast()
var/savefile/f = new("world_fast.sav")
var/list/l = new
for(var/turf/t in world)
if(!istype(t,/turf/black))
l += "t=[t.type];x=[t.x];y=[t.y];z=[t.z]"
f << l
LoadWorld_Fast()
var/timestart = world.timeofday
if(!fexists("world_fast.sav")) return
var/savefile/f = new("world_fast.sav")
var/list/l = new
f >> l
for(var/t in l)
var/list/params = params2list(t)
var/path = text2path(params["t"])
var/xx = text2num(params["x"])
var/yy = text2num(params["y"])
var/zz = text2num(params["z"])
new path(locate(xx,yy,zz))
world << world.timeofday - timestart
Problem description:
I would expect this block of code to take approximately the same amount of execution time every time... especially considering the file size is not changing in between successive loads.
Don't quote me on this, as I'm not a BYOND developer, I can't tell you how this would be handled.
Try changing:
To:
If I'm right in my thinking, this should cause the file pointer to be closed in order for it to be used immediately in the next function call.