Save_Area()
First loop
1) Check all the rooms currently in the game
2) make sure they have a vnum
3) save them to a file, all named by vnum
4) add them to the master save/load list
Second loop is debugging info, note that NOTHING shows up during runtime from this second loop
5) save the master save/load list to room.list
Load_Area()
1) Load the master save/load list from room.list
First loop
2) Check all the rooms currently in the game
3) Move all 'live' mobiles to null
4) Delete the room
Second loop
5) Scan through the master list
6) Load each item found in the master list to a new room (note that these are saved by vnums, and the master list consists of vnums. Too bad the master list doesn't exist, read the second loop section of Save_Area())
7) Add the new room to the world_rooms list
Third (and final) loop is more debugging info
mob/proc
Save_Area()
var/save_rooms[]
for(var/room/R in world_rooms)
if(R.vnum)
world << "[R] in world_rooms"
var/savefile/S
S = new(file("areas/[R.vnum].room"))
S << R
world << "[R.name] ([R.vnum]) saved to [S]"
save_rooms += "[R.vnum]"
for(var/O in save_rooms)
world << "[O] in save_rooms"
var/savefile/S
S = new("room.list")
S["list"] << save_rooms
world << "save_rooms saved to [S]"
/*
for(var/R in world_rooms)
if(R)
var/savefile/S
S = new(file("areas/[R:vnum].room"))
S << R
world << "[R:name] ([R:vnum]) saved to [S]"
var/save_rooms[]
for(var/room/R in world_rooms)
save_rooms += R
world << "[R] added to save_rooms"
var/savefile/S
S = new(file("areas/room.lst"))
S["list"] << save_rooms
world << "save_rooms saved to /areas/room.lst"
*/
Load_Area()
var/load_rooms[]
var/savefile/S
S = new("room.list")
S["list"] >> load_rooms
world << "load_rooms loaded from [S]"
for(var/room/R in world_rooms)
for(var/mob/M in R.contents)
if(M.client)
M.loc = null
world << "moved [M] to null from [R]"
world << "deleted [R]"
del(R)
for(var/L in load_rooms)
world << "[L] found in load_rooms"
var/room/N
var/savefile/S2
S2 = file("areas/[L].room")
N << S2
new N(null)
world_rooms += N
world << "[N] added to world_rooms"
world << "world_rooms loaded"
for(var/R in world_rooms)
world << "[R] in world_rooms"
/*
var/load_rooms[]
var/dummy_list[]
for(var/room/R in world_rooms)
for(var/M in R.contents)
M:loc = null
usr << "moved [M] to null"
usr << "deleted [R]"
del(R)
for(var/L in load_rooms)
var/room/N
var/savefile/C
C = new(file("areas/[L:vnum].room"))
world << "[N] loaded from [C]"
N = new L(null)
world_rooms += N
world << "world_rooms loaded"
for(var/R in world_rooms)
world << "[R] in world_rooms"
*/