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

@@ -16,7 +16,7 @@
// 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)
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
@@ -183,8 +183,8 @@
//Parses a string into a list
/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
@@ -280,9 +280,9 @@
//This is used for fingerprints
/proc/stringmerge(var/text,var/compare,replace = "*")
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
@@ -302,7 +302,7 @@
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++
@@ -317,8 +317,8 @@
//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 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)
return max(min(middle, high), low)
#if DM_VERSION < 513
proc/arctan(x)
var/y=arcsin(x/sqrt(1+x*x))
return y
#endif
//returns random gauss number
proc/GaussRand(var/sigma)