ID:262475
 
Problem description:Code:
Basicly, it saves all fine, but, It doesnt load...any idea why. I am sure, I am doing something wrong..

When you try to load, it freezes for a while(Loading)..but i wait, and it never finishs..the map is only 100x100, so I don't see the problem.
proc
SaveObjects()
var/savefile/F = new ("objects.sav")
var/list/L = new
var/O as obj|turf
for(O in world)
if(!istype(O,/turf/Grass))
O:saved_x = O:x
O:saved_y = O:y
O:saved_z = O:z
L += O
F[""] << L
world << "Map Saved!"

proc/LoadObjects()
var/savefile/F = new ("objects.sav")
var/list/L = new
F[""] >> L
if(!L) return
var/O as obj|turf
for(O in world) if(O:loc) del(O)
for(O in L)
if(!istype(O,/turf/Grass))
O:loc = locate(O:saved_x,O:saved_y,O:saved_z)
world << "Map Loaded!"



Sort of sounds like an infinite loop is crashing it, but maybe not.
you notice the top of the code in save objects has the
proc
Save Objects()

but you have the other one
proc/LoadObjects()



it could be even the dumbist things! I have no clue if this works! Just a suggestion!
In response to Rockinawsome
Try:
obj/var
saved_x
saved_y
saved_z
turf/var
saved_x
saved_y
saved_z

proc/SaveObjects()
var/savefile/F = new ("World.sav")
var/objs[0]
var/turfs[0]
for(var/obj/O in world)
O.saved_x = O.x
O.saved_y = O.y
O.saved_z = O.z
objs.Add(O)
F["Objects"] << objs
for(var/turf/A in world)
if(!istype(A,/turf/Grass))
A.saved_x = A.x
A.saved_y = A.y
A.saved_z = A.z
turfs.Add(A)
F["Turfs"] << turfs
world << "Map Saved!"

proc/LoadObjects()
var/savefile/F = new ("World.sav")
var/objs[0]
var/turfs[0]
F["Objects"] >> objs
F["Turfs"] >> turfs
if(length(objs))
for(var/obj/o in objs)
o.loc = locate(o.saved_x,o.saved_y,o.saved_z)
objs.Remove(o)
objs.Cut()
if(length(turfs))
for(var/turf/T in turfs))
if(!istype(T,/turf/Grass))
T = locate(T.saved_x,T.saved_y,T.saved_z)
turfs.Remove(T)
turfs.Cut()
world << "Map Loaded!"


Turfs have a unique way of being placed, so you may have to modify the turf placement. I beleive that's how I got it to work last time, anyway.