to_chat replacing stream operator

This commit is contained in:
Arokha Sieyes
2020-02-15 12:40:07 -05:00
committed by Leshana
parent 5aaba55222
commit 5b15917d32
712 changed files with 4250 additions and 4220 deletions

View File

@@ -50,7 +50,7 @@ proc/dmp2swapmap(filename)
while(txt)
if(text2ascii(txt)==34)
if(mode!=34)
world << "Corrupt map file [filename]: Unexpected code found after z-level [z]"
to_world("Corrupt map file [filename]: Unexpected code found after z-level [z]")
return
// standard line:
// "a" = (/obj, /obj, /turf, /area)
@@ -59,20 +59,20 @@ proc/dmp2swapmap(filename)
codelen=length(code)
i=findtext(txt,"(",i)
if(!i)
world << "Corrupt map file [filename]: No type list follows \"[code]\""
to_world("Corrupt map file [filename]: No type list follows \"[code]\"")
return
k=findtext(txt,"\n",++i)
j=(k || length(txt+1))
while(--j>=i && text2ascii(txt,j)!=41)
if(j<i)
world << "Corrupt map file [filename]: Type list following \"[code]\" is incomplete"
to_world("Corrupt map file [filename]: Type list following \"[code]\" is incomplete")
return
var/list/L = d2sm_ParseCommaList(copytext(txt,i,j))
if(istext(L))
world << "Corrupt map file [filename]: [L]"
to_world("Corrupt map file [filename]: [L]")
return
if(L.len<2)
world << "Corrupt map file [filename]: Type list following \"[code]\" has only 1 item"
to_world("Corrupt map file [filename]: Type list following \"[code]\" has only 1 item")
return
txt=k?copytext(txt,k+1):null
if(L[L.len] == "[world.area]") L[L.len]=0
@@ -96,25 +96,25 @@ proc/dmp2swapmap(filename)
// "}
i=d2sm_MatchBrace(txt,1,40)
if(!i)
world << "Corrupt map file [filename]: No matching ) for coordinates: [copytext(txt,1,findtext(txt,"\n"))]"
to_world("Corrupt map file [filename]: No matching ) for coordinates: [copytext(txt,1,findtext(txt,"\n"))]")
return
var/list/coords=d2sm_ParseCommaList(copytext(txt,2,i))
if(istext(coords) || coords.len!=3)
world << "Corrupt map file [filename]: [istext(coords)?(coords):"[copytext(txt,1,i+1)] is not a valid (x,y,z) coordinate"]"
to_world("Corrupt map file [filename]: [istext(coords)?(coords):"[copytext(txt,1,i+1)] is not a valid (x,y,z) coordinate"]")
return
j=findtext(txt,"{",i+1)
if(!j)
world << "Corrupt map file [filename]: No braces {} following [copytext(txt,1,i+1)]"
to_world("Corrupt map file [filename]: No braces {} following [copytext(txt,1,i+1)]")
return
k=d2sm_MatchBrace(txt,j,123)
if(!k)
world << "Corrupt map file [filename]: No closing brace } following [copytext(txt,1,i+1)]"
to_world("Corrupt map file [filename]: No closing brace } following [copytext(txt,1,i+1)]")
return
var/mtxt=copytext(txt,j+1,k)
if(findText(mtxt,"\"\n")!=1 || !findText(mtxt,"\n\"",length(mtxt)-1))
world << findText(mtxt,"\"\n")
world << findText(mtxt,"\n\"",length(mtxt)-1)
world << "Corrupt map file [filename]: No quotes in braces following [copytext(txt,1,i+1)]"
to_world(findText(mtxt,"\"\n"))
to_world(findText(mtxt,"\n\"",length(mtxt)-1))
to_world("Corrupt map file [filename]: No quotes in braces following [copytext(txt,1,i+1)]")
return
mtxt=copytext(mtxt,2,length(mtxt))
var/_x=0,_y=0
@@ -131,21 +131,21 @@ proc/dmp2swapmap(filename)
else
i=findtext(txt,"\n")
txt=i?copytext(txt,i+1):null
world << "Map size: [X],[Y],[Z]"
to_world("Map size: [X],[Y],[Z]")
//for(var/code in codes)
// world << "Code \"[code]\":\n[codes[code]]"
// to_world("Code \"[code]\":\n[codes[code]]")
fdel("map_[mapname].txt")
var/F = file("map_[mapname].txt")
F << ". = object(\".0\")\n.0\n\ttype = /swapmap\n\tid = \"[mapname]\"\n\tz = [Z]\n\ty = [Y]\n\tx = [X]"
to_chat(F, ". = object(\".0\")\n.0\n\ttype = /swapmap\n\tid = \"[mapname]\"\n\tz = [Z]\n\ty = [Y]\n\tx = [X]")
if(areas)
txt=""
for(i=0,i<areas.len,++i)
txt+="[i?", ":""]object(\".[i]\")"
F << "\tareas = list([txt])"
to_chat(F, "\tareas = list([txt])")
for(i=0,i<areas.len,++i)
F << "\t\t.[i]"
to_chat(F, "\t\t.[i]")
txt=d2sm_ConvertType(areas[i+1],"\t\t\t")
F << copytext(txt,1,length(txt))
to_chat(F,copytext(txt,1,length(txt)))
// 2nd pass
txt=d2sm_prepmap(filename)
@@ -168,24 +168,24 @@ proc/dmp2swapmap(filename)
_x=max(_x,(j-i-1)/codelen)
i=j
// print out this z-level now
F << "\t[coords[3]]"
to_chat(F, "\t[coords[3]]")
i=1
for(var/y=_y,y>0,--y) // map is top-down
++i
F << "\t\t[y]"
to_chat(F, "\t\t[y]")
for(var/x in 1 to _x)
F << "\t\t\t[x]"
to_chat(F, "\t\t\t[x]")
j=i+codelen
F << codes[copytext(mtxt,i,j)]
to_chat(F, codes[copytext(mtxt,i,j)])
i=j
txt=copytext(txt,k+1)
/* for(z in 1 to Z)
F << "\t[z]"
to_chat(F, "\t[z]")
for(var/y in 1 to Y)
F << "\t\t[y]"
to_chat(F, "\t\t[y]")
for(var/x in 1 to X)
F << "\t\t\t[x]"
F << codes[pick(codes)] */
to_chat(F, "\t\t\t[x]")
to_chat(F, codes[pick(codes)]) */
proc/d2sm_ParseCommaList(txt)
var/list/L=new

View File

@@ -585,7 +585,7 @@ proc/SwapMaps_CreateFromTemplate(template_id)
else if(swapmaps_mode!=SWAPMAPS_TEXT && fexists("map_[template_id].txt"))
text=1
else
world.log << "SwapMaps error in SwapMaps_CreateFromTemplate(): map_[template_id] file not found."
to_world_log("SwapMaps error in SwapMaps_CreateFromTemplate(): map_[template_id] file not found.")
return
if(text)
S=new
@@ -612,7 +612,7 @@ proc/SwapMaps_LoadChunk(chunk_id,turf/locorner)
else if(swapmaps_mode!=SWAPMAPS_TEXT && fexists("map_[chunk_id].txt"))
text=1
else
world.log << "SwapMaps error in SwapMaps_LoadChunk(): map_[chunk_id] file not found."
to_world_log("SwapMaps error in SwapMaps_LoadChunk(): map_[chunk_id] file not found.")
return
if(text)
S=new
@@ -630,9 +630,9 @@ proc/SwapMaps_LoadChunk(chunk_id,turf/locorner)
proc/SwapMaps_SaveChunk(chunk_id,turf/corner1,turf/corner2)
if(!corner1 || !corner2)
world.log << "SwapMaps error in SwapMaps_SaveChunk():"
if(!corner1) world.log << " corner1 turf is null"
if(!corner2) world.log << " corner2 turf is null"
to_world_log("SwapMaps error in SwapMaps_SaveChunk():")
if(!corner1) to_world_log(" corner1 turf is null")
if(!corner2) to_world_log(" corner2 turf is null")
return
var/swapmap/M=new
M.id=chunk_id
@@ -659,7 +659,7 @@ proc/SwapMaps_GetSize(id)
else if(swapmaps_mode!=SWAPMAPS_TEXT && fexists("map_[id].txt"))
text=1
else
world.log << "SwapMaps error in SwapMaps_GetSize(): map_[id] file not found."
to_world_log("SwapMaps error in SwapMaps_GetSize(): map_[id] file not found.")
return
if(text)
S=new

View File

@@ -234,7 +234,7 @@
var/area/new_area = get_area(check)
if(!(istype(new_area, whitelist)))
valid = FALSE // Probably overlapping something important.
// world << "Invalid due to overlapping with area [new_area.type] at ([check.x], [check.y], [check.z]), when attempting to place at ([T.x], [T.y], [T.z])."
// to_world("Invalid due to overlapping with area [new_area.type] at ([check.x], [check.y], [check.z]), when attempting to place at ([T.x], [T.y], [T.z]).")
break
CHECK_TICK