ID:142130
 
Code:
world
New()
if(fexists("MAP.dat"))
load_worldvars()
if(load_world)
loadmap()
else
createmap()
for(var/turf/Trees/T in world)
T.AutoJoin()
else
createmap()
for(var/turf/Trees/T in world)
T.AutoJoin()
haspopd = 1
..()
Del()
if(save_map)
savemap()
load_world = 1
save_worldvars()
..()
proc
savemap()
var/dmp_writer/D = new()
var/turf/south_west_deep = locate(1,1,2)
var/turf/north_east_shallow = locate(100,100,2)
D.save_map(south_west_deep, north_east_shallow, "MAP", flags = DMP_IGNORE_PLAYERS)
loadmap()
var/dmp_reader/new_reader = new()
//need to set new_reader Z to 2, not 3...
new_reader.load_map("MAP.dat")
save_worldvars()
if(!fexists("globals.sav")) //check if the file exists first
return 0 //if it doesn't, stop
var/savefile/F = new("globals.sav")
F << load_world
F << speed
load_worldvars()
if(!fexists("globals.sav")) //check if the file exists first
return 0 //if it doesn't, stop
var/savefile/F = new("globals.sav")
F >> load_world
F >> speed


Problem description:
Im using the dmp_reader and dmp_writer libraries. I want the code to save the FULL map with Z level of 2 if save_map is true, and some world vars as well. The problem is that even if save_map is true nothing is saved or loaded.
In response to Axerob
No he shouldn't. It's not currently working properly.
In response to Popisfizzy
Popisfizzy wrote:
No he shouldn't. It's not currently working properly.

I guess you changing your gender must've screwed up your programming abilities huh?
In response to Axerob
Considering it has been this way for most of the summer, I'd say no.
I don't see anything specifically wrong with that code, so could you post some more information? Try these and tell us what happens:

A) Try running what you have under world/Del() from a verb instead and see if it works. If it does, you could have world/Del() defined somewhere else without ..() (the parent process) being called.

B) Add some debug statements to see how far it's getting. Doing something like world<<"Check 1" under world/Del(), world<<"Check 2" under savemap(), and so on to see how far down it gets. Be sure to sleep a second or so before calling ..() in world/Del(), or you won't have time to read the output.

Report back with the results and then we'll help you track down your problem.
In response to DarkCampainger
A) Try running what you have under world/Del() from a verb instead and see if it works. If it does, you could have world/Del() defined somewhere else without ..() (the parent process) being called.

Whe world/Del() is not being called anywhere (i know this from searching Del() using all files, and also i keep all my procs in seperate folder for each type, like Mob_Procs and World_Procs)

B) Add some debug statements to see how far it's getting. Doing something like world<<"Check 1" under world/Del(), world<<"Check 2" under savemap(), and so on to see how far down it gets. Be sure to sleep a second or so before calling ..() in world/Del(), or you won't have time to read the output.

I have debug defined, there are no runtime errors, it just wont save the project when the server shuts down.

What specifically happens

Start:
Run (ctrl+R)
Asks me to verify access to file MAP.dat
Click Yes
If no file present, sets up world properly
Close Server
Nothing gets saved (neither the vars or the map)

NOTES: I would probably use the other library (Lummox JR's swapmaps), i just cant figure it out :P. The other one (pid_maploader) just didn't work, im not sure why.

Im testing another theroy, ill post resaults in one min.

Edit
Tried it, didnt work.
HAve another question as well, why when i set maxx and maxy does all my tiles in my first map get replaced with world/tile?
In response to KingCold999
KingCold999 wrote:
HAve another question as well, why when i set maxx and maxy does all my tiles in my first map get replaced with world/tile?

No.

If you set maxx/maxy/maxz at compile-time, a default project map with 1 or [maxz] z-levels will be included before your maps.

I don't know if this is an intended behavior or a bug considering that you don't need a default project map 'cause you already have one (or more).

If you don't like how it works, set maxx/maxy/maxz at runtime.