Skip to content

Commit

Permalink
Removes the rest of the calls to lentext() (#24877)
Browse files Browse the repository at this point in the history
* These ones are entirely unnecessary

* These ones need to be replaced
  • Loading branch information
Exxion authored and ShiftyRail committed Nov 8, 2019
1 parent 18a8a1b commit 5621f3b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@
update_faction_icons()

/datum/mind/proc/store_memory(new_text)
if(lentext(memory) > MAX_PAPER_MESSAGE_LEN)
if(length(memory) > MAX_PAPER_MESSAGE_LEN)
to_chat(current, "<span class = 'warning'>Your memory, however hazy, is full.</span>")
return
if(lentext(new_text) > MAX_MESSAGE_LEN)
if(length(new_text) > MAX_MESSAGE_LEN)
to_chat(current, "<span class = 'warning'>That's a lot to memorize at once.</span>")
return
if(new_text)
Expand Down
14 changes: 7 additions & 7 deletions code/game/objects/structures/musician.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@
if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case
playing = 0
return
if(lentext(note) == 0)
if(length(note) == 0)
continue
//world << "Parse: [copytext(note,1,2)]"
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")
Expand Down Expand Up @@ -221,11 +221,11 @@
t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", name), t) as message)
if(!in_range(instrumentObj, usr))
return
if(lentext(t) >= INSTRUMENT_MAX_LINE_LENGTH*INSTRUMENT_MAX_LINE_NUMBER)
if(length(t) >= INSTRUMENT_MAX_LINE_LENGTH*INSTRUMENT_MAX_LINE_NUMBER)
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) > INSTRUMENT_MAX_LINE_LENGTH*INSTRUMENT_MAX_LINE_NUMBER)
while(length(t) > INSTRUMENT_MAX_LINE_LENGTH*INSTRUMENT_MAX_LINE_NUMBER)
//split into lines
spawn()
lines = splittext(t, "\n")
Expand All @@ -243,7 +243,7 @@
lines.Cut(INSTRUMENT_MAX_LINE_NUMBER+1)
var/linenum = 1
for(var/l in lines)
if(lentext(l) > INSTRUMENT_MAX_LINE_LENGTH)
if(length(l) > INSTRUMENT_MAX_LINE_LENGTH)
alert(usr, "Line [linenum] too long! Removing...")
lines.Remove(l)
else
Expand All @@ -270,7 +270,7 @@
return
if(lines.len > INSTRUMENT_MAX_LINE_NUMBER)
return
if(lentext(newline) > INSTRUMENT_MAX_LINE_LENGTH)
if(length(newline) > INSTRUMENT_MAX_LINE_LENGTH)
newline = copytext(newline, 1, INSTRUMENT_MAX_LINE_LENGTH)
lines.Add(newline)
else if(href_list["deleteline"])
Expand All @@ -285,7 +285,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) > INSTRUMENT_MAX_LINE_LENGTH)
if(length(content) > INSTRUMENT_MAX_LINE_LENGTH)
content = copytext(content, 1, INSTRUMENT_MAX_LINE_LENGTH)
if(num > lines.len || num < 1)
return
Expand Down
2 changes: 1 addition & 1 deletion code/libs/s_html/hexadecimal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proc/hex2num(hex)
var/num = 0
var/power = 0

for(var/i = lentext(hex), i > 0, i--)
for(var/i = length(hex), i > 0, i--)
var/char = copytext(hex, i, i+1) //extract hexadecimal character from string
switch(char)
if("0")
Expand Down
8 changes: 4 additions & 4 deletions code/libs/s_html/inverthtml.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ proc/invertHTML(HTMLstring)
textr = num2hex(255-r)
textg = num2hex(255-g)
textb = num2hex(255-b)
if(lentext(textr) < 2)
if(length(textr) < 2)
textr = "0[textr]"
if(lentext(textg) < 2)
if(length(textg) < 2)
textr = "0[textg]"
if(lentext(textb) < 2)
if(length(textb) < 2)
textr = "0[textb]"

return("#[textr][textg][textb]")
Expand All @@ -38,4 +38,4 @@ proc/invertHTML(HTMLstring)
mob/verb/test_invertHTML()
to_chat(usr, "#CC9933")
to_chat(usr, invertHTML("#CC9933"))
*/
*/
4 changes: 2 additions & 2 deletions code/modules/organs/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ proc/blood_incompatible(donor,receiver)
if(!donor || !receiver)
return 0

var/donor_antigen = copytext(donor,1,lentext(donor))
var/receiver_antigen = copytext(receiver,1,lentext(receiver))
var/donor_antigen = copytext(donor, 1, -1)
var/receiver_antigen = copytext(receiver, 1, -1)
var/donor_rh = (findtext(donor,"+")>0)
var/receiver_rh = (findtext(receiver,"+")>0)

Expand Down
14 changes: 7 additions & 7 deletions tools/Redirector/textprocs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ proc/dd_replaceText(text, search_string, replacement_string)
/////////////////////
proc/dd_hasprefix(text, prefix)
var/start = 1
var/end = lentext(prefix) + 1
var/end = length(prefix) + 1
return findtext(text, prefix, start, end)

proc/dd_hasPrefix(text, prefix)
var/start = 1
var/end = lentext(prefix) + 1
var/end = length(prefix) + 1
return findtextEx(text, prefix, start, end)


Expand All @@ -66,8 +66,8 @@ proc/dd_hasSuffix(text, suffix)
// Turning text into lists //
/////////////////////////////
proc/dd_splittext(text, separator)
var/textlength = lentext(text)
var/separatorlength = lentext(separator)
var/textlength = length(text)
var/separatorlength = length(separator)
var/list/textList = new /list()
var/searchPosition = 1
var/findPosition = 1
Expand All @@ -86,8 +86,8 @@ proc/dd_splittext(text, separator)
return textList

proc/dd_text2List(text, separator)
var/textlength = lentext(text)
var/separatorlength = lentext(separator)
var/textlength = length(text)
var/separatorlength = length(separator)
var/list/textList = new /list()
var/searchPosition = 1
var/findPosition = 1
Expand Down Expand Up @@ -150,4 +150,4 @@ proc/dd_limittext(message, length)
if (size <= length)
return message
else
return copytext(message, 1, length + 1)
return copytext(message, 1, length + 1)

0 comments on commit 5621f3b

Please sign in to comment.