ID:139003
 
Code:
var/list/hashstrings = list("alpha", "beta", "gamma", "delta", "release", "a", "b", "c", "d", "e", "f", "g", "h", "i")

Instance
Map
var
hash
swapmap/map

New(_hash)
if( !(_hash) ) hash = pick(hashstrings) + pick(hashstrings) + pick(hashstrings) + pick(hashstrings)
else hash = _hash
map = new(_hash)
map = SwapMaps_CreateFromTemplate(_hash)
map.id = "[hash][pick(hashstrings)][pick(hashstrings)][pick(hashstrings)][pick(hashstrings)]"
hash = map.id
if(map)
..()

else del src

Del()
var/swapmap/map = SwapMaps_Find(hash)
if( map ) del map
..()


So i've got this code, which utilizes Lummox's SwapMap library. I have one currently working Instance. However, that map has only 1 set of turfs on it. Then I have This one which has mobs, and turfs that have contents(other turfs) on it.

Upon loading this map, i get the following errors:
proc name: Read (/atom/Read)
source file: SwapMaps.dm,490
usr: the derfwer (/mob)
src: Shinobi: Online (1,1,12) (/turf/player_barrier)
call stack:
Shinobi: Online (1,1,12) (/turf/player_barrier): Read(C:\\Users\\Axerob\\Documents\\... (/savefile))
/swapmap (/swapmap): Read(C:\\Users\\Axerob\\Documents\\... (/savefile), /swapmap (/swapmap), null)
SwapMaps CreateFromTemplate("Slums")
Map (/Instance/Map): New("Slums")
Slums (/Instance/Slums): Action(the derfwer (/mob))
the derfwer (/mob): Do()
runtime error: Cannot create objects of type null.
proc name: Read (/swapmap/Read)
source file: SwapMaps.dm,287
usr: the derfwer (/mob)
src: /swapmap (/swapmap)
call stack:
/swapmap (/swapmap): Read(C:\\Users\\Axerob\\Documents\\... (/savefile), /swapmap (/swapmap), null)
SwapMaps CreateFromTemplate("Slums")
Map (/Instance/Map): New("Slums")
Slums (/Instance/Slums): Action(the derfwer (/mob))
the derfwer (/mob): Do()


The first runtime error is probably directly related to the second one, as this falls under atom/Read
    Read(savefile/S)
var/list/l
if(contents.len) l=contents
..() // this happens to be line 490, so this is probably directly related to the second error i have
// if the icon was a text string, it would not have loaded properly
// replace it from the cache list
if(!icon && ("icon" in S.dir))
var/ic
S["icon"]>>ic
if(istext(ic)) icon=swapmaps_iconcache[ic]
if(l && contents!=l)
contents+=l
del(l)


The second runtime error falls under swapmap/Read()
    Read(savefile/S,_id,turf/locorner)
var
x;y;z;n
list/areas
area/defarea=locate(world.area)
id=_id
if(locorner)
ischunk=1
x1=locorner.x
y1=locorner.y
z1=locorner.z
if(!defarea) defarea=new world.area
if(!_id)
//world << "New id"
S["id"] >> id
else
var/dummy
S["id"] >> dummy
//world << dummy
S["z"] >> z2 // these are depth,
S["y"] >> y2 // height,
S["x"] >> x2 // width
S["areas"] >> areas
locked=1
AllocateSwapMap() // adjust x1,y1,z1 - x2,y2,z2 coords
//world << "successfully allocated map"
var/oldcd=S.cd
world << S.cd
for(z=z1,z<=z2,++z)
S.cd="[z-z1+1]"
world << S.cd
for(y=y1,y<=y2,++y)
S.cd="[y-y1+1]"
world << S.cd
for(x=x1,x<=x2,++x)
S.cd="[x-x1+1]"
world << S.cd
var/tp
S["type"]>>tp
var/turf/T=locate(x,y,z)
T.loc.contents-=T
T=new tp(locate(x,y,z)) // this is the line which the runtime is occuring on
if("AREA" in S.dir)
S["AREA"]>>n
var/area/A=areas[n]
A.contents+=T
else defarea.contents+=T
// clear the turf
for(var/obj/O in T) del(O)
for(var/mob/M in T)
if(!M.key) del(M)
else M.loc=null
// finish the read
T.Read(S)
S.cd=".."
world << S.cd
S.cd=".."
world << S.cd
sleep()
S.cd=oldcd
world << S.cd
locked=0
del(areas)


I have modified this slightly to show how far in the loading process it gets before it crashes and this is what it yields.

/.0
/.0/1
/.0/1/1
/.0/1/1/1
/.0/1/1/1/contents
/.0/1/1/1/contents/2


If you reference this to the text file i posted above(click the link), you'll see it happens right away, and only when the turf has contents(works fine on an "empty(1 set of turfs, like all grass) map"). Is there a fix for this? The actual map size is "25,100", so this is just testing it.