ID:266935
 
proc/Saveworld()
var/turf/O
var/savefile/F=new("world.sav")
for(O in world.contents)
F<<O

proc/loadworld()
var/turf/O
var/savefile/F=new("world.sav")
for(O in world.contents)
F>>O

world/New()
loadworld()
..()
world/Del()
Saveworld()
..()
it saves, but when i reboot or rehost, my DS crashes</<o>
turf
var
saved_x
saved_y
saved_z
proc/Saveworld()
var/savefile/F = new ("world.sav")
var/list/L = new
for(var/turf/O in world.contents)
O.saved_x = O.x
O.saved_y = O.y
O.saved_z = O.z
L += O
F[""] << L
proc/Loadworld()
var/savefile/F = new ("world.sav")
var/list/L = new
F[""] >> L
if(!L) return

for(var/turf/O in world.contents)
if(O.loc)
del(O)

for(var/turf/O in L)
O.loc = locate(O.saved_x,O.saved_y,O.saved_z)

world/New()
Loadworld()
world/Del()
Saveworld()


I believe that would work. Hope it helps
proc/loadworld()
var/turf/O
var/savefile/F=new("world.sav")
for(O in world.contents)
F>>O

You are trying to stuff the entire saved world into each and every turf in your map. No wonder it chokes!
In response to Skysaw
sky saw, what suggestions do you have then like make two savefiles, each with the turfs in a certain block of the map? its just an idea, i have no idea how to go about it.
In response to Magnus VI
No, you need to read the file into a list of turfs, and do a for loop on that list, creating new turfs for each one.
In response to Skysaw
Will the code i put up work?