replaces lentext() with length()

This commit is contained in:
Kyep
2020-01-06 16:01:20 -08:00
parent 2208fb3407
commit 2fd66d8510
18 changed files with 51 additions and 51 deletions
+1 -1
View File
@@ -2,5 +2,5 @@
#define TYPEID_NULL "0"
#define TYPEID_NORMAL_LIST "f"
//helper macros
#define GET_TYPEID(ref) ( ( (lentext(ref) <= 10) ? "TYPEID_NULL" : copytext(ref, 4, lentext(ref) - 6) ) )
#define GET_TYPEID(ref) ( ( (length(ref) <= 10) ? "TYPEID_NULL" : copytext(ref, 4, length(ref) - 6) ) )
#define IS_NORMAL_LIST(L) (GET_TYPEID("\ref[L]") == TYPEID_NORMAL_LIST)
+7 -7
View File
@@ -20,7 +20,7 @@
if(!istext(t))
t = "[t]" // Just quietly assume any non-texts are supposed to be text
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
/proc/format_table_name(table as text)
return sqlfdbktableprefix + table
@@ -333,9 +333,9 @@ proc/checkhtml(var/t)
//is in the other string at the same spot (assuming it is not a replace char).
//This is used for fingerprints
var/newtext = text
if(lentext(text) != lentext(compare))
if(length(text) != length(compare))
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/b = copytext(compare,i,i+1)
//if it isn't both the same letter, or if they are both the replacement character
@@ -355,7 +355,7 @@ proc/checkhtml(var/t)
if(!text || !character)
return 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)
if(a == character)
count++
@@ -400,8 +400,8 @@ proc/checkhtml(var/t)
//Used in preferences' SetFlavorText and human's set_flavor verb
//Previews a string of len or less length
/proc/TextPreview(var/string,var/len=40)
if(lentext(string) <= len)
if(!lentext(string))
if(length(string) <= len)
if(!length(string))
return "\[...\]"
else
return html_encode(string) //NO DECODED HTML YOU CHUCKLEFUCKS
@@ -541,7 +541,7 @@ proc/checkhtml(var/t)
text = "<font face=\"[deffont]\" color=[P ? P.colour : "black"]>[text]</font>"
else
text = "<font face=\"[deffont]\">[text]</font>"
text = copytext(text, 1, MAX_PAPER_MESSAGE_LEN)
return text
+1 -1
View File
@@ -444,7 +444,7 @@
//Stolen from status_display
/obj/machinery/door_timer/proc/texticon(tn, px = 0, py = 0)
var/image/I = image('icons/obj/status_display.dmi', "blank")
var/len = lentext(tn)
var/len = length(tn)
for(var/d = 1 to len)
var/char = copytext(tn, len-d+1, len-d+2)
+1 -1
View File
@@ -14,7 +14,7 @@
else
message1 = "CARGO"
message2 = SSshuttle.supply.getTimerStr()
if(lentext(message2) > CHARS_PER_LINE)
if(length(message2) > CHARS_PER_LINE)
message2 = "Error"
update_display(message1, message2)
+7 -7
View File
@@ -88,12 +88,12 @@
if(!playing || shouldStopPlaying(user)) //If the instrument is playing, or special case
playing = 0
return
if(lentext(note) == 0)
if(length(note) == 0)
continue
var/cur_note = text2ascii(note) - 96
if(cur_note < 1 || cur_note > 7)
continue
for(var/i=2 to lentext(note))
for(var/i=2 to length(note))
var/ni = copytext(note,i,i+1)
if(!text2num(ni))
if(ni == "#" || ni == "b" || ni == "n")
@@ -159,11 +159,11 @@
if(!in_range(instrumentObj, usr))
return
if(lentext(t) >= 12000)
if(length(t) >= 12000)
var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
if(cont == "no")
break
while(lentext(t) > 12000)
while(length(t) > 12000)
//split into lines
spawn()
@@ -180,7 +180,7 @@
lines.Cut(201)
var/linenum = 1
for(var/l in lines)
if(lentext(l) > 200)
if(length(l) > 200)
to_chat(usr, "Line [linenum] too long!")
lines.Remove(l)
else
@@ -223,7 +223,7 @@
return
if(lines.len > 200)
return
if(lentext(newline) > 200)
if(length(newline) > 200)
newline = copytext(newline, 1, 200)
lines.Insert(num, newline)
@@ -241,7 +241,7 @@
var/content = html_encode(input("Enter your line: ", instrumentObj.name, lines[num]) as text|null)
if(!content || !in_range(instrumentObj, usr))
return
if(lentext(content) > 200)
if(length(content) > 200)
content = copytext(content, 1, 200)
if(num > lines.len || num < 1)
return
+4 -4
View File
@@ -469,13 +469,13 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
if(playercid)
cidsearch = "AND computerid = '[playercid]' "
else
if(adminckey && lentext(adminckey) >= 3)
if(adminckey && length(adminckey) >= 3)
adminsearch = "AND a_ckey LIKE '[adminckey]%' "
if(playerckey && lentext(playerckey) >= 3)
if(playerckey && length(playerckey) >= 3)
playersearch = "AND ckey LIKE '[playerckey]%' "
if(playerip && lentext(playerip) >= 3)
if(playerip && length(playerip) >= 3)
ipsearch = "AND ip LIKE '[playerip]%' "
if(playercid && lentext(playercid) >= 7)
if(playercid && length(playercid) >= 7)
cidsearch = "AND computerid LIKE '[playercid]%' "
if(dbbantype)
+4 -4
View File
@@ -3066,7 +3066,7 @@
else if(href_list["ac_set_channel_name"])
src.admincaster_feed_channel.channel_name = strip_html_simple(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", ""))
while(findtext(src.admincaster_feed_channel.channel_name," ") == 1)
src.admincaster_feed_channel.channel_name = copytext(src.admincaster_feed_channel.channel_name,2,lentext(src.admincaster_feed_channel.channel_name)+1)
src.admincaster_feed_channel.channel_name = copytext(src.admincaster_feed_channel.channel_name,2,length(src.admincaster_feed_channel.channel_name)+1)
src.access_news_network()
else if(href_list["ac_set_channel_lock"])
@@ -3105,7 +3105,7 @@
else if(href_list["ac_set_new_message"])
src.admincaster_feed_message.body = adminscrub(input(usr, "Write your Feed story", "Network Channel Handler", ""))
while(findtext(src.admincaster_feed_message.body," ") == 1)
src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.body,2,lentext(src.admincaster_feed_message.body)+1)
src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.body,2,length(src.admincaster_feed_message.body)+1)
src.access_news_network()
else if(href_list["ac_submit_new_message"])
@@ -3159,13 +3159,13 @@
else if(href_list["ac_set_wanted_name"])
src.admincaster_feed_message.author = adminscrub(input(usr, "Provide the name of the Wanted person", "Network Security Handler", ""))
while(findtext(src.admincaster_feed_message.author," ") == 1)
src.admincaster_feed_message.author = copytext(admincaster_feed_message.author,2,lentext(admincaster_feed_message.author)+1)
src.admincaster_feed_message.author = copytext(admincaster_feed_message.author,2,length(admincaster_feed_message.author)+1)
src.access_news_network()
else if(href_list["ac_set_wanted_desc"])
src.admincaster_feed_message.body = adminscrub(input(usr, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", ""))
while(findtext(src.admincaster_feed_message.body," ") == 1)
src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.body,2,lentext(src.admincaster_feed_message.body)+1)
src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.body,2,length(src.admincaster_feed_message.body)+1)
src.access_news_network()
else if(href_list["ac_submit_wanted"])
+4 -4
View File
@@ -306,11 +306,11 @@ var/list/VVpixelmovement = list("step_x", "step_y", "step_size", "bound_height",
// the type with the base type removed from the begaining
var/fancytype = types[D.type]
if(findtext(fancytype, types[type]))
fancytype = copytext(fancytype, lentext(types[type])+1)
var/shorttype = copytext("[D.type]", lentext("[type]")+1)
if(lentext(shorttype) > lentext(fancytype))
fancytype = copytext(fancytype, length(types[type])+1)
var/shorttype = copytext("[D.type]", length("[type]")+1)
if(length(shorttype) > length(fancytype))
shorttype = fancytype
if(!lentext(shorttype))
if(!length(shorttype))
shorttype = "/"
.["[D]([shorttype])\ref[D]#[i]"] = D
@@ -294,8 +294,8 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
dat += "<b>Disabilities:</b> <a href='?_src_=prefs;preference=disabilities'>\[Set\]</a><br>"
dat += "<b>Nanotrasen Relation:</b> <a href ='?_src_=prefs;preference=nt_relation;task=input'>[nanotrasen_relation]</a><br>"
dat += "<a href='byond://?_src_=prefs;preference=flavor_text;task=input'>Set Flavor Text</a><br>"
if(lentext(flavor_text) <= 40)
if(!lentext(flavor_text)) dat += "\[...\]<br>"
if(length(flavor_text) <= 40)
if(!length(flavor_text)) dat += "\[...\]<br>"
else dat += "[flavor_text]<br>"
else dat += "[TextPreview(flavor_text)]...<br>"
@@ -886,21 +886,21 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
HTML += "<a href=\"byond://?_src_=prefs;preference=records;task=med_record\">Medical Records</a><br>"
if(lentext(med_record) <= 40)
if(length(med_record) <= 40)
HTML += "[med_record]"
else
HTML += "[copytext(med_record, 1, 37)]..."
HTML += "<br><a href=\"byond://?_src_=prefs;preference=records;task=gen_record\">Employment Records</a><br>"
if(lentext(gen_record) <= 40)
if(length(gen_record) <= 40)
HTML += "[gen_record]"
else
HTML += "[copytext(gen_record, 1, 37)]..."
HTML += "<br><a href=\"byond://?_src_=prefs;preference=records;task=sec_record\">Security Records</a><br>"
if(lentext(sec_record) <= 40)
if(length(sec_record) <= 40)
HTML += "[sec_record]<br>"
else
HTML += "[copytext(sec_record, 1, 37)]...<br>"
+1 -1
View File
@@ -527,7 +527,7 @@ BLIND // can't see anything
end up with a suffix of _open_open if adjusted twice, since their initial state is _open. */
item_state = copytext(item_state, 1, findtext(item_state, "_open"))
if(adjust_flavour)
flavour = "[copytext(adjust_flavour, 3, lentext(adjust_flavour) + 1)] up" //Trims off the 'un' at the beginning of the word. unzip -> zip, unbutton->button.
flavour = "[copytext(adjust_flavour, 3, length(adjust_flavour) + 1)] up" //Trims off the 'un' at the beginning of the word. unzip -> zip, unbutton->button.
to_chat(user, "You [flavour] \the [src].")
suit_adjusted = 0 //Suit is no longer adjusted.
for(var/X in actions)
+2 -2
View File
@@ -1,7 +1,7 @@
proc/Intoxicated(phrase)
phrase = html_decode(phrase)
var/leng=lentext(phrase)
var/counter=lentext(phrase)
var/leng=length(phrase)
var/counter=length(phrase)
var/newphrase=""
var/newletter=""
while(counter>=1)
+1 -1
View File
@@ -162,7 +162,7 @@
if(copytext(heardword,1, 1) in punctuation)
heardword = copytext(heardword,2)
if(copytext(heardword,-1) in punctuation)
heardword = copytext(heardword,1,lentext(heardword))
heardword = copytext(heardword,1,length(heardword))
heard = "<span class='game say'>...<i>You hear something about<i>... '[heardword]'...</span>"
else
heard = "<span class='game say'>...<i>You almost hear something...</i>...</span>"
@@ -376,7 +376,7 @@
msg += "*---------*</span>"
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.
msg += "\n[p_they(TRUE)] [p_are()] [pose]"
+1 -1
View File
@@ -538,7 +538,7 @@
if(print_flavor_text()) msg += "\n[print_flavor_text()]"
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.
msg += "\nIt is [pose]"
msg += "\n*---------*</span>"
@@ -50,7 +50,7 @@
if(print_flavor_text()) msg += "\n[print_flavor_text()]\n"
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.
msg += "\nIt is [pose]"
+1 -1
View File
@@ -726,7 +726,7 @@ var/list/slot_equipment_priority = list( \
/mob/proc/print_flavor_text(var/shrink = 1)
if(flavor_text && flavor_text != "")
var/msg = replacetext(flavor_text, "\n", " ")
if(lentext(msg) <= 40 || !shrink)
if(length(msg) <= 40 || !shrink)
return "<span class='notice'>[html_encode(msg)]</span>" //Repeat after me, "I will not give players access to decoded HTML."
else
return "<span class='notice'>[copytext_preserve_html(msg, 1, 37)]... <a href='byond://?src=[UID()];flavor_more=1'>More...</a></span>"
+7 -7
View File
@@ -201,8 +201,8 @@
/proc/slur(phrase, var/list/slurletters = ("'"))//use a different list as an input if you want to make robots slur with $#@%! characters
phrase = html_decode(phrase)
var/leng=lentext(phrase)
var/counter=lentext(phrase)
var/leng=length(phrase)
var/counter=length(phrase)
var/newphrase=""
var/newletter=""
while(counter>=1)
@@ -295,8 +295,8 @@
proc/muffledspeech(phrase)
phrase = html_decode(phrase)
var/leng=lentext(phrase)
var/counter=lentext(phrase)
var/leng=length(phrase)
var/counter=length(phrase)
var/newphrase=""
var/newletter=""
while(counter>=1)
@@ -571,7 +571,7 @@ var/list/intents = list(INTENT_HELP,INTENT_DISARM,INTENT_GRAB,INTENT_HARM)
for(var/datum/objective/objective in GLOB.all_objectives)
if(!mind || objective.target != mind)
continue
length = lentext(oldname)
length = length(oldname)
pos = findtextEx(objective.explanation_text, oldname)
objective.explanation_text = copytext(objective.explanation_text, 1, pos)+newname+copytext(objective.explanation_text, pos+length)
return 1
@@ -610,8 +610,8 @@ var/list/intents = list(INTENT_HELP,INTENT_DISARM,INTENT_GRAB,INTENT_HARM)
/proc/cultslur(n) // Inflicted on victims of a stun talisman
var/phrase = html_decode(n)
var/leng = lentext(phrase)
var/counter=lentext(phrase)
var/leng = length(phrase)
var/counter=length(phrase)
var/newphrase=""
var/newletter=""
while(counter>=1)
+2 -2
View File
@@ -475,7 +475,7 @@
SSnanoui.update_uis(src)
return 1
var/index = copytext(href_list["doorder"], 1, lentext(href_list["doorder"])) //text2num(copytext(href_list["doorder"], 1))
var/index = copytext(href_list["doorder"], 1, length(href_list["doorder"])) //text2num(copytext(href_list["doorder"], 1))
var/multi = text2num(copytext(href_list["doorder"], -1))
if(!isnum(multi))
return 1
@@ -656,7 +656,7 @@
SSnanoui.update_uis(src)
return 1
var/index = copytext(href_list["doorder"], 1, lentext(href_list["doorder"])) //text2num(copytext(href_list["doorder"], 1))
var/index = copytext(href_list["doorder"], 1, length(href_list["doorder"])) //text2num(copytext(href_list["doorder"], 1))
var/multi = text2num(copytext(href_list["doorder"], -1))
if(!isnum(multi))
return 1