ID:144931
 
Code:
var
const/saveall=1 //Set to 1 if you want to save the whole map. Don't place any area/saves if this is 1
area/save/Area //Don't need to tamper with this
area/save
New(){if(!Area) Area=src; ..()}


proc/SaveMap(SaveObjects=1,SaveTurfs=1)
if(fexists(MAPFILE)) fdel(MAPFILE)
var/savefile/S=new(MAPFILE)
var/list/Turfs=list()
var/list/Objs=list()
for(var/atom/A in ((saveall)?(world):(Area)))
if(SaveObjects && istype(A,OBJSAVTYPE))
Objs+=A
Objs[A]="[A.x],[A.y]/[A.z]"
else if(SaveTurfs && istype(A,TURFSAVTYPE))
Turfs+=A
Turfs[A]="[A.x],[A.y]/[A.z]"
var/turf/turfs=Turfs[Turfs.Find(A)]
turfs.contents.Cut()
continue
S["Objects"]<<Objs
S["Turfs"]<<Turfs

proc/LoadMap(LoadObjects=1,LoadTurfs=1)
if(!fexists(MAPFILE)) return
var/savefile/S=new(MAPFILE)
var/list/Objs=S["Objects"]
var/list/Turfs=S["Turfs"]
if(LoadTurfs) for(var/turf/T in Turfs) T=ReturnLoc(Turfs[T])
if(LoadObjects) for(var/obj/O in Objs) O.loc=ReturnLoc(Objs[O])

proc/ReturnLoc(t)
ASSERT(t)
var/x=text2num(copytext(t,1,findtext(t,",")))
var/y=text2num(copytext(t,length(x)+2,findtext(t,"/")))
var/z=text2num(copytext(t,length(x)+length(y)+2))
return locate(x,y,z)</b>


Problem description:i tried to use a freinds save system but everytime i do i get major lag and it tells me byond has a string overload...any suggestions?
I also tried this one but it only saves objects:
obj
var //These vars define the terms so they
saved_x //are recognized.
saved_y
saved_z

proc
SaveObjects() //This is the Save proc.
var/savefile/F = new ("objects.sav") //creates the save file
var/list/L = new
for(var/obj/O in world)
O.saved_x = O.x //these tell the game to save the objects
O.saved_y = O.y //location.
O.saved_z = O.z
L += O
F[""] << L

proc/LoadObjects() //Its time to load the objs!
var/savefile/F = new ("objects.sav")
var/list/L = new
F[""] >> L
if(!L) return
for(var/obj/O in world) if(O.loc) del(O)
for(var/obj/O in L)
O.loc = locate(O.saved_x,O.saved_y,O.saved_z) //loads the obj
//location

mob/GM/verb/Save() //the save verb
SaveObjects()


mob/GM/verb/Load() //the load verb
LoadObjects()