Preparation for 513 (#7677)

* Preparation for 513

* lentext replacement
This commit is contained in:
Matt Atlas
2019-12-18 08:10:16 +01:00
committed by Werner
parent 8ad9e76bed
commit decc0b14a7
26 changed files with 86 additions and 73 deletions

View File

@@ -12,7 +12,10 @@
#define LAZYDISTINCTADD(L, I) if(!L) { L = list(); } L |= I; #define LAZYDISTINCTADD(L, I) if(!L) { L = list(); } L |= I;
// Shims for some list procs in lists.dm. // Shims for some list procs in lists.dm.
#define islist(L) istype(L,/list)
#define isemptylist(L) (!LAZYLEN(L)) #define isemptylist(L) (!LAZYLEN(L))
#define safepick(L) LAZYPICK(L,null) #define safepick(L) LAZYPICK(L,null)
#define listgetindex(L,I) LAZYACCESS(L,I) #define listgetindex(L,I) LAZYACCESS(L,I)
#if DM_VERSION < 513
#define islist(L) istype(L,/list)
#endif

View File

@@ -273,8 +273,16 @@
// Used for creating soft references to objects. A manner of storing an item reference // Used for creating soft references to objects. A manner of storing an item reference
// as text so you don't necessarily fuck with an object's ability to be garbage collected. // as text so you don't necessarily fuck with an object's ability to be garbage collected.
#if DM_VERSION < 513
#define SOFTREF(A) "\ref[A]" #define SOFTREF(A) "\ref[A]"
#else
#define SOFTREF(A) ref(A)
#endif
// This only works on 511 because it relies on 511's `var/something = foo = bar` syntax. // This only works on 511 because it relies on 511's `var/something = foo = bar` syntax.
#define WEAKREF(D) (istype(D, /datum) && !D:gcDestroyed ? (D:weakref || (D:weakref = new(D))) : null) #define WEAKREF(D) (istype(D, /datum) && !D:gcDestroyed ? (D:weakref || (D:weakref = new(D))) : null)

View File

@@ -16,7 +16,7 @@
// Run all strings to be used in an SQL query through this proc first to properly escape out injection attempts. // Run all strings to be used in an SQL query through this proc first to properly escape out injection attempts.
/proc/sanitizeSQL(var/t as text) /proc/sanitizeSQL(var/t as text)
var/sqltext = dbcon.Quote(t); var/sqltext = dbcon.Quote(t);
return copytext(sqltext, 2, lentext(sqltext));//Quote() adds quotes around input, we already do that return copytext(sqltext, 2, length(sqltext));//Quote() adds quotes around input, we already do that
/* /*
* Text sanitization * Text sanitization
@@ -183,8 +183,8 @@
//Parses a string into a list //Parses a string into a list
/proc/dd_text2List(text, separator) /proc/dd_text2List(text, separator)
var/textlength = lentext(text) var/textlength = length(text)
var/separatorlength = lentext(separator) var/separatorlength = length(separator)
var/list/textList = new /list() var/list/textList = new /list()
var/searchPosition = 1 var/searchPosition = 1
var/findPosition = 1 var/findPosition = 1
@@ -280,9 +280,9 @@
//This is used for fingerprints //This is used for fingerprints
/proc/stringmerge(var/text,var/compare,replace = "*") /proc/stringmerge(var/text,var/compare,replace = "*")
var/newtext = text var/newtext = text
if(lentext(text) != lentext(compare)) if(length(text) != length(compare))
return 0 return 0
for(var/i = 1, i < lentext(text), i++) for(var/i = 1, i < length(text), i++)
var/a = copytext(text,i,i+1) var/a = copytext(text,i,i+1)
var/b = copytext(compare,i,i+1) var/b = copytext(compare,i,i+1)
//if it isn't both the same letter, or if they are both the replacement character //if it isn't both the same letter, or if they are both the replacement character
@@ -302,7 +302,7 @@
if(!text || !character) if(!text || !character)
return 0 return 0
var/count = 0 var/count = 0
for(var/i = 1, i <= lentext(text), i++) for(var/i = 1, i <= length(text), i++)
var/a = copytext(text,i,i+1) var/a = copytext(text,i,i+1)
if(a == character) if(a == character)
count++ count++
@@ -317,8 +317,8 @@
//Used in preferences' SetFlavorText and human's set_flavor verb //Used in preferences' SetFlavorText and human's set_flavor verb
//Previews a string of len or less length //Previews a string of len or less length
proc/TextPreview(var/string,var/len=40) proc/TextPreview(var/string,var/len=40)
if(lentext(string) <= len) if(length(string) <= len)
if(!lentext(string)) if(!length(string))
return "\[...\]" return "\[...\]"
else else
return string return string

View File

@@ -559,9 +559,11 @@ Turf and target are seperate in case you want to teleport some distance from a t
/proc/between(var/low, var/middle, var/high) /proc/between(var/low, var/middle, var/high)
return max(min(middle, high), low) return max(min(middle, high), low)
#if DM_VERSION < 513
proc/arctan(x) proc/arctan(x)
var/y=arcsin(x/sqrt(1+x*x)) var/y=arcsin(x/sqrt(1+x*x))
return y return y
#endif
//returns random gauss number //returns random gauss number
proc/GaussRand(var/sigma) proc/GaussRand(var/sigma)

View File

@@ -395,7 +395,7 @@
//Stolen from status_display //Stolen from status_display
/obj/machinery/door_timer/proc/texticon(var/tn, var/px = 0, var/py = 0) /obj/machinery/door_timer/proc/texticon(var/tn, var/px = 0, var/py = 0)
var/image/I = image('icons/obj/status_display.dmi', "blank") var/image/I = image('icons/obj/status_display.dmi', "blank")
var/len = lentext(tn) var/len = length(tn)
for(var/d = 1 to len) for(var/d = 1 to len)
var/char = copytext(tn, len-d+1, len-d+2) var/char = copytext(tn, len-d+1, len-d+2)

View File

@@ -11,7 +11,7 @@
message2 = "Error" message2 = "Error"
else if(shuttle.has_arrive_time()) else if(shuttle.has_arrive_time())
message2 = get_supply_shuttle_timer() message2 = get_supply_shuttle_timer()
if(lentext(message2) > CHARS_PER_LINE) if(length(message2) > CHARS_PER_LINE)
message2 = "Error" message2 = "Error"
else if (shuttle.is_launching()) else if (shuttle.is_launching())
if (shuttle.at_station()) if (shuttle.at_station())
@@ -47,7 +47,7 @@
message2 = "Error" message2 = "Error"
else if(shuttle.has_arrive_time()) else if(shuttle.has_arrive_time())
message2 = get_arrivals_shuttle_timer() message2 = get_arrivals_shuttle_timer()
if(lentext(message2) > CHARS_PER_LINE) if(length(message2) > CHARS_PER_LINE)
message2 = "Error" message2 = "Error"
else if (shuttle.is_launching()) else if (shuttle.is_launching())
if (shuttle.at_station()) if (shuttle.at_station())

View File

@@ -206,12 +206,12 @@
if(!playing || !isliving(loc))//If the violin is playing, or isn't held by a person if(!playing || !isliving(loc))//If the violin is playing, or isn't held by a person
playing = 0 playing = 0
return return
if(lentext(note) == 0) if(length(note) == 0)
continue continue
var/cur_note = text2ascii(note) - 96 var/cur_note = text2ascii(note) - 96
if(cur_note < 1 || cur_note > 7) if(cur_note < 1 || cur_note > 7)
continue continue
for(var/i=2 to lentext(note)) for(var/i=2 to length(note))
var/ni = copytext(note,i,i+1) var/ni = copytext(note,i,i+1)
if(!text2num(ni)) if(!text2num(ni))
if(ni == "#" || ni == "b" || ni == "n") if(ni == "#" || ni == "b" || ni == "n")
@@ -317,7 +317,7 @@
return return
if(song.lines.len > 50) if(song.lines.len > 50)
return return
if(lentext(newline) > 50) if(length(newline) > 50)
newline = copytext(newline, 1, 50) newline = copytext(newline, 1, 50)
song.lines.Add(newline) song.lines.Add(newline)
@@ -332,7 +332,7 @@
var/content = html_encode(input("Enter your line: ", "violin", song.lines[num]) as text|null) var/content = html_encode(input("Enter your line: ", "violin", song.lines[num]) as text|null)
if(!content) if(!content)
return return
if(lentext(content) > 50) if(length(content) > 50)
content = copytext(content, 1, 50) content = copytext(content, 1, 50)
if(num > song.lines.len || num < 1) if(num > song.lines.len || num < 1)
return return
@@ -354,11 +354,11 @@
if(!in_range(src, usr)) if(!in_range(src, usr))
return return
if(lentext(t) >= 3072) if(length(t) >= 3072)
var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no") var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
if(cont == "no") if(cont == "no")
break break
while(lentext(t) > 3072) while(length(t) > 3072)
//split into lines //split into lines
spawn() spawn()
@@ -372,7 +372,7 @@
lines.Cut(51) lines.Cut(51)
var/linenum = 1 var/linenum = 1
for(var/l in lines) for(var/l in lines)
if(lentext(l) > 50) if(length(l) > 50)
to_chat(usr, "Line [linenum] too long!") to_chat(usr, "Line [linenum] too long!")
lines.Remove(l) lines.Remove(l)
else else

View File

@@ -19,7 +19,7 @@
/obj/item/reagent_containers/glass/paint/Initialize() /obj/item/reagent_containers/glass/paint/Initialize()
. = ..() . = ..()
if(paint_type && lentext(paint_type) > 0) if(paint_type && length(paint_type) > 0)
name = paint_type + " " + name name = paint_type + " " + name
reagents.add_reagent("water", volume*3/5) reagents.add_reagent("water", volume*3/5)
reagents.add_reagent("plasticide", volume/5) reagents.add_reagent("plasticide", volume/5)

View File

@@ -226,12 +226,12 @@
if(!playing || !anchored)//If the piano is playing, or is loose if(!playing || !anchored)//If the piano is playing, or is loose
playing = 0 playing = 0
return return
if(lentext(note) == 0) if(length(note) == 0)
continue continue
var/cur_note = text2ascii(note) - 96 var/cur_note = text2ascii(note) - 96
if(cur_note < 1 || cur_note > 7) if(cur_note < 1 || cur_note > 7)
continue continue
for(var/i=2 to lentext(note)) for(var/i=2 to length(note))
var/ni = copytext(note,i,i+1) var/ni = copytext(note,i,i+1)
if(!text2num(ni)) if(!text2num(ni))
if(ni == "#" || ni == "b" || ni == "n") if(ni == "#" || ni == "b" || ni == "n")
@@ -343,7 +343,7 @@
return return
if(song.lines.len > 50) if(song.lines.len > 50)
return return
if(lentext(newline) > 50) if(length(newline) > 50)
newline = copytext(newline, 1, 50) newline = copytext(newline, 1, 50)
song.lines.Add(newline) song.lines.Add(newline)
@@ -358,7 +358,7 @@
var/content = html_encode(input("Enter your line: ", "Piano", song.lines[num]) as text|null) var/content = html_encode(input("Enter your line: ", "Piano", song.lines[num]) as text|null)
if(!content) if(!content)
return return
if(lentext(content) > 50) if(length(content) > 50)
content = copytext(content, 1, 50) content = copytext(content, 1, 50)
if(num > song.lines.len || num < 1) if(num > song.lines.len || num < 1)
return return
@@ -380,11 +380,11 @@
if (!in_range(src, usr)) if (!in_range(src, usr))
return return
if(lentext(t) >= 3072) if(length(t) >= 3072)
var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no") var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
if(cont == "no") if(cont == "no")
break break
while(lentext(t) > 3072) while(length(t) > 3072)
//split into lines //split into lines
spawn() spawn()
@@ -398,7 +398,7 @@
lines.Cut(51) lines.Cut(51)
var/linenum = 1 var/linenum = 1
for(var/l in lines) for(var/l in lines)
if(lentext(l) > 50) if(length(l) > 50)
to_chat(usr, "Line [linenum] too long!") to_chat(usr, "Line [linenum] too long!")
lines.Remove(l) lines.Remove(l)
else else

View File

@@ -411,13 +411,13 @@
cidsearch = "AND computerid = '[playercid]' " cidsearch = "AND computerid = '[playercid]' "
mirror_cid = "AND mirrors.computerid = '[playercid]'" mirror_cid = "AND mirrors.computerid = '[playercid]'"
else else
if(adminckey && lentext(adminckey) >= 3) if(adminckey && length(adminckey) >= 3)
adminsearch = "AND a_ckey LIKE '[adminckey]%' " adminsearch = "AND a_ckey LIKE '[adminckey]%' "
if(playerckey && lentext(playerckey) >= 3) if(playerckey && length(playerckey) >= 3)
playersearch = "AND ckey LIKE '[playerckey]%' " playersearch = "AND ckey LIKE '[playerckey]%' "
if(playerip && lentext(playerip) >= 3) if(playerip && length(playerip) >= 3)
ipsearch = "AND ip LIKE '[playerip]%' " ipsearch = "AND ip LIKE '[playerip]%' "
if(playercid && lentext(playercid) >= 7) if(playercid && length(playercid) >= 7)
cidsearch = "AND computerid LIKE '[playercid]%' " cidsearch = "AND computerid LIKE '[playercid]%' "
if(dbbantype) if(dbbantype)

View File

@@ -2,8 +2,8 @@
proc/Intoxicated(phrase) proc/Intoxicated(phrase)
phrase = html_decode(phrase) phrase = html_decode(phrase)
var/leng=lentext(phrase) var/leng=length(phrase)
var/counter=lentext(phrase) var/counter=length(phrase)
var/newphrase="" var/newphrase=""
var/newletter="" var/newletter=""
while(counter>=1) while(counter>=1)
@@ -48,7 +48,7 @@ proc/stutter(phrase, str = 1)
if(!R.Find(word)) if(!R.Find(word))
continue continue
if (lentext(word) > 1) if (length(word) > 1)
if((prob(20) && str > 1) || (prob(30) && str > 4)) // stutter word instead if((prob(20) && str > 1) || (prob(30) && str > 4)) // stutter word instead
var/stuttered = R.group[2] + R.group[3] var/stuttered = R.group[2] + R.group[3]
if(upper.Find(stuttered) && !upper.Find(stuttered, 2)) // if they're screaming (all caps) or saying something like 'AI', keep the letter capitalized - else don't if(upper.Find(stuttered) && !upper.Find(stuttered, 2)) // if they're screaming (all caps) or saying something like 'AI', keep the letter capitalized - else don't
@@ -56,7 +56,7 @@ proc/stutter(phrase, str = 1)
word = R.Replace(word, "$1$2$3-[stuttered]$4") word = R.Replace(word, "$1$2$3-[stuttered]$4")
else if(prob(25) && str > 1) // prolong word else if(prob(25) && str > 1) // prolong word
var/prolonged = "" var/prolonged = ""
var/prolong_amt = min(lentext(word), 5) var/prolong_amt = min(length(word), 5)
prolong_amt = rand(1, prolong_amt) prolong_amt = rand(1, prolong_amt)
for(var/j = 0, j < prolong_amt, j++) for(var/j = 0, j < prolong_amt, j++)
prolonged += R.group[2] prolonged += R.group[2]

View File

@@ -249,7 +249,7 @@
if(copytext(heardword,1, 1) in punctuation) if(copytext(heardword,1, 1) in punctuation)
heardword = copytext(heardword,2) heardword = copytext(heardword,2)
if(copytext(heardword,-1) in punctuation) if(copytext(heardword,-1) in punctuation)
heardword = copytext(heardword,1,lentext(heardword)) heardword = copytext(heardword,1,length(heardword))
heard = "<span class = 'game_say'>...You hear something about...[heardword]</span>" heard = "<span class = 'game_say'>...You hear something about...[heardword]</span>"
else else

View File

@@ -366,7 +366,7 @@
msg += "*---------*</span>" msg += "*---------*</span>"
if (pose) if (pose)
if( findtext(pose,".",lentext(pose)) == 0 && findtext(pose,"!",lentext(pose)) == 0 && findtext(pose,"?",lentext(pose)) == 0 ) if( findtext(pose,".",length(pose)) == 0 && findtext(pose,"!",length(pose)) == 0 && findtext(pose,"?",length(pose)) == 0 )
pose = addtext(pose,".") //Makes sure all emotes end with a period. pose = addtext(pose,".") //Makes sure all emotes end with a period.
msg += "\n[T.He] [pose]" msg += "\n[T.He] [pose]"

View File

@@ -12,7 +12,7 @@
if(print_flavor_text()) msg += "\n[print_flavor_text()]\n" if(print_flavor_text()) msg += "\n[print_flavor_text()]\n"
if (pose) if (pose)
if( findtext(pose,".",lentext(pose)) == 0 && findtext(pose,"!",lentext(pose)) == 0 && findtext(pose,"?",lentext(pose)) == 0 ) if( findtext(pose,".",length(pose)) == 0 && findtext(pose,"!",length(pose)) == 0 && findtext(pose,"?",length(pose)) == 0 )
pose = addtext(pose,".") //Makes sure all emotes end with a period. pose = addtext(pose,".") //Makes sure all emotes end with a period.
msg += "\nIt [pose]" msg += "\nIt [pose]"

View File

@@ -39,7 +39,7 @@
if(print_flavor_text()) msg += "\n[print_flavor_text()]\n" if(print_flavor_text()) msg += "\n[print_flavor_text()]\n"
if (pose) if (pose)
if( findtext(pose,".",lentext(pose)) == 0 && findtext(pose,"!",lentext(pose)) == 0 && findtext(pose,"?",lentext(pose)) == 0 ) if( findtext(pose,".",length(pose)) == 0 && findtext(pose,"!",length(pose)) == 0 && findtext(pose,"?",length(pose)) == 0 )
pose = addtext(pose,".") //Makes sure all emotes end with a period. pose = addtext(pose,".") //Makes sure all emotes end with a period.
msg += "\nIt [pose]" msg += "\nIt [pose]"

View File

@@ -424,7 +424,7 @@
/mob/proc/print_flavor_text() /mob/proc/print_flavor_text()
if (flavor_text && flavor_text != "") if (flavor_text && flavor_text != "")
var/msg = replacetext(flavor_text, "\n", " ") var/msg = replacetext(flavor_text, "\n", " ")
if(lentext(msg) <= 40) if(length(msg) <= 40)
return "<span class='notice'>[msg]</span>" return "<span class='notice'>[msg]</span>"
else else
return "<span class='notice'>[copytext_preserve_html(msg, 1, 37)]... <a href='byond://?src=\ref[src];flavor_more=1'>More...</a></span>" return "<span class='notice'>[copytext_preserve_html(msg, 1, 37)]... <a href='byond://?src=\ref[src];flavor_more=1'>More...</a></span>"

View File

@@ -334,8 +334,8 @@ var/list/global/organ_rel_size = list(
proc/slur(phrase, strength = 100) proc/slur(phrase, strength = 100)
phrase = html_decode(phrase) phrase = html_decode(phrase)
var/leng=lentext(phrase) var/leng=length(phrase)
var/counter=lentext(phrase) var/counter=length(phrase)
var/newphrase="" var/newphrase=""
var/newletter="" var/newletter=""
while(counter>=1) while(counter>=1)

View File

@@ -248,8 +248,8 @@ proc/blood_incompatible(donor,receiver,donor_species,receiver_species)
if(donor_species != receiver_species) if(donor_species != receiver_species)
return 1 return 1
var/donor_antigen = copytext(donor,1,lentext(donor)) var/donor_antigen = copytext(donor,1,length(donor))
var/receiver_antigen = copytext(receiver,1,lentext(receiver)) var/receiver_antigen = copytext(receiver,1,length(receiver))
var/donor_rh = (findtext(donor,"+")>0) var/donor_rh = (findtext(donor,"+")>0)
var/receiver_rh = (findtext(receiver,"+")>0) var/receiver_rh = (findtext(receiver,"+")>0)

View File

@@ -998,7 +998,7 @@ Note that amputating the affected organ does in fact remove the infection from t
W.germ_level = 0 W.germ_level = 0
return rval return rval
/obj/item/organ/external/proc/clamp() /obj/item/organ/external/proc/clamp_organ()
var/rval = 0 var/rval = 0
src.status &= ~ORGAN_BLEEDING src.status &= ~ORGAN_BLEEDING
for(var/datum/wound/W in wounds) for(var/datum/wound/W in wounds)

View File

@@ -95,9 +95,9 @@
var/spawn_type = pop(spawning_types) var/spawn_type = pop(spawning_types)
var/obj/spawned_obj = new spawn_type(src.loc) var/obj/spawned_obj = new spawn_type(src.loc)
if(source_material) if(source_material)
if(lentext(source_material.name) < MAX_MESSAGE_LEN) if(length(source_material.name) < MAX_MESSAGE_LEN)
spawned_obj.name = "[source_material] " + spawned_obj.name spawned_obj.name = "[source_material] " + spawned_obj.name
if(lentext(source_material.desc) < MAX_MESSAGE_LEN * 2) if(length(source_material.desc) < MAX_MESSAGE_LEN * 2)
if(spawned_obj.desc) if(spawned_obj.desc)
spawned_obj.desc += " It is made of [source_material]." spawned_obj.desc += " It is made of [source_material]."
else else

View File

@@ -41,7 +41,7 @@
else if(findtext(msg," ")==0) else if(findtext(msg," ")==0)
return return
else else
/*var/l = lentext(msg) /*var/l = length(msg)
if(findtext(msg," ",l,l+1)==0) if(findtext(msg," ",l,l+1)==0)
msg+=" "*/ msg+=" "*/
seperate = text2list(msg, " ") seperate = text2list(msg, " ")
@@ -77,12 +77,12 @@
text = "[pick(heard_words)]" text = "[pick(heard_words)]"
else else
text = pick(text2list(word, " ")) text = pick(text2list(word, " "))
if(lentext(text)==1) if(length(text)==1)
text=uppertext(text) text=uppertext(text)
else else
var/cap = copytext(text,1,2) var/cap = copytext(text,1,2)
cap = uppertext(cap) cap = uppertext(cap)
cap += copytext(text,2,lentext(text)+1) cap += copytext(text,2,length(text)+1)
text=cap text=cap
var/q = 0 var/q = 0
msg+=text msg+=text

View File

@@ -141,7 +141,7 @@ proc/string_tolist(var/string)
var/list/L = new/list() var/list/L = new/list()
var/i var/i
for(i=1, i<=lentext(string), i++) for(i=1, i<=length(string), i++)
L.Add(copytext(string, i, i)) L.Add(copytext(string, i, i))
return L return L
@@ -154,12 +154,12 @@ proc/string_explode(var/string, var/separator)
var/lasti = 1 var/lasti = 1
var/list/L = new/list() var/list/L = new/list()
for(i=1, i<=lentext(string)+1, i++) for(i=1, i<=length(string)+1, i++)
if(copytext(string, i, i+1) == separator) // We found a separator if(copytext(string, i, i+1) == separator) // We found a separator
L.Add(copytext(string, lasti, i)) L.Add(copytext(string, lasti, i))
lasti = i+1 lasti = i+1
L.Add(copytext(string, lasti, lentext(string)+1)) // Adds the last segment L.Add(copytext(string, lasti, length(string)+1)) // Adds the last segment
return L return L
@@ -186,7 +186,7 @@ proc/n_reverse(var/string)
if(istext(string)) if(istext(string))
var/newstring = "" var/newstring = ""
var/i var/i
for(i=lentext(string), i>0, i--) for(i=length(string), i>0, i--)
if(i>=1000) if(i>=1000)
break break
newstring = newstring + copytext(string, i, i+1) newstring = newstring + copytext(string, i, i+1)
@@ -250,9 +250,9 @@ proc/n_inrange(var/num, var/min=-1, var/max=1)
/proc/string_replacetext(var/haystack,var/a,var/b) /proc/string_replacetext(var/haystack,var/a,var/b)
if(istext(haystack)&&istext(a)&&istext(b)) if(istext(haystack)&&istext(a)&&istext(b))
var/i = 1 var/i = 1
var/lenh=lentext(haystack) var/lenh=length(haystack)
var/lena=lentext(a) var/lena=length(a)
//var/lenb=lentext(b) //var/lenb=length(b)
var/count = 0 var/count = 0
var/list/dat = list() var/list/dat = list()
while (i < lenh) while (i < lenh)

View File

@@ -31,8 +31,8 @@ n_scriptOptions
IsValidID(id) //returns true if all the characters in the string are okay to be in an identifier name IsValidID(id) //returns true if all the characters in the string are okay to be in an identifier name
if(!CanStartID(id)) //don't need to grab first char in id, since text2ascii does it automatically if(!CanStartID(id)) //don't need to grab first char in id, since text2ascii does it automatically
return 0 return 0
if(lentext(id)==1) return 1 if(length(id)==1) return 1
for(var/i=2 to lentext(id)) for(var/i=2 to length(id))
if(!IsValidIDChar(copytext(id, i, i+1))) if(!IsValidIDChar(copytext(id, i, i+1)))
return 0 return 0
return 1 return 1

View File

@@ -115,7 +115,7 @@
Scan() //Creates a list of tokens from source code Scan() //Creates a list of tokens from source code
var/list/tokens=new var/list/tokens=new
for(, src.codepos<=lentext(code), src.codepos++) for(, src.codepos<=length(code), src.codepos++)
var/char=copytext(code, codepos, codepos+1) var/char=copytext(code, codepos, codepos+1)
if(char=="\n") if(char=="\n")
@@ -154,7 +154,7 @@
*/ */
ReadString(start) ReadString(start)
var/buf var/buf
for(, codepos <= lentext(code), codepos++)//codepos to lentext(code)) for(, codepos <= length(code), codepos++)//codepos to length(code))
var/char=copytext(code, codepos, codepos+1) var/char=copytext(code, codepos, codepos+1)
switch(char) switch(char)
if("\\") //Backslash (\) encountered in string if("\\") //Backslash (\) encountered in string
@@ -190,7 +190,7 @@
ReadWord() ReadWord()
var/char=copytext(code, codepos, codepos+1) var/char=copytext(code, codepos, codepos+1)
var/buf var/buf
while(!delim.Find(char) && codepos<=lentext(code)) while(!delim.Find(char) && codepos<=length(code))
buf+=char buf+=char
char=copytext(code, ++codepos, codepos+1) char=copytext(code, ++codepos, codepos+1)
codepos-- //allow main Scan() proc to read the delimiter codepos-- //allow main Scan() proc to read the delimiter
@@ -209,7 +209,7 @@
while(options.symbols.Find(buf+char)) while(options.symbols.Find(buf+char))
buf+=char buf+=char
if(++codepos>lentext(code)) break if(++codepos>length(code)) break
char=copytext(code, codepos, codepos+1) char=copytext(code, codepos, codepos+1)
codepos-- //allow main Scan() proc to read the next character codepos-- //allow main Scan() proc to read the next character
@@ -255,7 +255,7 @@
comm = 2 // starts a multi-line comment comm = 2 // starts a multi-line comment
while(comm) while(comm)
if(++codepos>lentext(code)) break if(++codepos>length(code)) break
if(expectedend) // ending statement expected... if(expectedend) // ending statement expected...
char = copytext(code, codepos, codepos+1) char = copytext(code, codepos, codepos+1)

View File

@@ -55,7 +55,7 @@
playsound(target.loc, 'sound/weapons/bladeslice.ogg', 50, 1) playsound(target.loc, 'sound/weapons/bladeslice.ogg', 50, 1)
target.apply_damage(1, BRUTE, target_zone, 0) target.apply_damage(1, BRUTE, target_zone, 0)
affected.clamp() affected.clamp_organ()
spread_germs_to_organ(affected, user) spread_germs_to_organ(affected, user)
/datum/surgery_step/generic/cut_with_laser/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) /datum/surgery_step/generic/cut_with_laser/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
@@ -95,7 +95,7 @@
affected.status |= ORGAN_BLEEDING affected.status |= ORGAN_BLEEDING
target.apply_damage(1, BRUTE, target_zone, 0) target.apply_damage(1, BRUTE, target_zone, 0)
affected.clamp() affected.clamp_organ()
affected.open = 2 affected.open = 2
/datum/surgery_step/generic/incision_manager/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) /datum/surgery_step/generic/incision_manager/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
@@ -216,7 +216,7 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone) var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='notice'>[user] clamps bleeders in [target]'s [affected.name] with \the [tool].</span>", \ user.visible_message("<span class='notice'>[user] clamps bleeders in [target]'s [affected.name] with \the [tool].</span>", \
"<span class='notice'>You clamp bleeders in [target]'s [affected.name] with \the [tool].</span>") "<span class='notice'>You clamp bleeders in [target]'s [affected.name] with \the [tool].</span>")
affected.clamp() affected.clamp_organ()
spread_germs_to_organ(affected, user) spread_germs_to_organ(affected, user)
playsound(target.loc, 'sound/items/Welder.ogg', 15, 1) playsound(target.loc, 'sound/items/Welder.ogg', 15, 1)

View File

@@ -40,12 +40,12 @@ proc
///////////////////// /////////////////////
dd_hasprefix(text, prefix) dd_hasprefix(text, prefix)
var/start = 1 var/start = 1
var/end = lentext(prefix) + 1 var/end = length(prefix) + 1
return findtext(text, prefix, start, end) return findtext(text, prefix, start, end)
dd_hasPrefix(text, prefix) dd_hasPrefix(text, prefix)
var/start = 1 var/start = 1
var/end = lentext(prefix) + 1 var/end = length(prefix) + 1
return findtextEx(text, prefix, start, end) return findtextEx(text, prefix, start, end)
@@ -64,8 +64,8 @@ proc
// Turning text into lists // // Turning text into lists //
///////////////////////////// /////////////////////////////
dd_text2list(text, separator) dd_text2list(text, separator)
var/textlength = lentext(text) var/textlength = length(text)
var/separatorlength = lentext(separator) var/separatorlength = length(separator)
var/list/textList = new /list() var/list/textList = new /list()
var/searchPosition = 1 var/searchPosition = 1
var/findPosition = 1 var/findPosition = 1
@@ -84,8 +84,8 @@ proc
return textList return textList
dd_text2List(text, separator) dd_text2List(text, separator)
var/textlength = lentext(text) var/textlength = length(text)
var/separatorlength = lentext(separator) var/separatorlength = length(separator)
var/list/textList = new /list() var/list/textList = new /list()
var/searchPosition = 1 var/searchPosition = 1
var/findPosition = 1 var/findPosition = 1