diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 83d603df..5bcee19f 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -1,10 +1,16 @@ // simple is_type and similar inline helpers +#if DM_VERSION < 513 #define islist(L) (istype(L, /list)) +#endif #define in_range(source, user) (get_dist(source, user) <= 1 && (get_step(source, 0)?:z) == (get_step(user, 0)?:z)) +#if DM_VERSION < 513 #define ismovableatom(A) (istype(A, /atom/movable)) +#else +#define ismovableatom(A) ismovable(A) +#endif #define isatom(A) (isloc(A)) diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm index d344f7f0..402c3dc1 100644 --- a/code/__DEFINES/maths.dm +++ b/code/__DEFINES/maths.dm @@ -30,7 +30,11 @@ // round() acts like floor(x, 1) by default but can't handle other values #define FLOOR(x, y) ( round((x) / (y)) * (y) ) +#if DM_VERSION < 513 #define CLAMP(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) ) +#else +#define CLAMP(CLVALUE,CLMIN,CLMAX) clamp(CLVALUE,CLMIN,CLMAX) +#endif // Similar to clamp but the bottom rolls around to the top and vice versa. min is inclusive, max is exclusive #define WRAP(val, min, max) ( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) ) @@ -39,7 +43,11 @@ #define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) ) // Tangent +#if DM_VERSION < 513 #define TAN(x) (sin(x) / cos(x)) +#else +#define TAN(x) tan(x) +#endif // Cotangent #define COT(x) (1 / TAN(x)) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 98d630b7..bb6fab9f 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -476,7 +476,7 @@ GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi', PDA_S #define PDAIMG(what) {""} //Filters -#define AMBIENT_OCCLUSION list("type"="drop_shadow","x"=0,"y"=-2,"size"=4,"border"=4,"color"="#04080FAA") +#define AMBIENT_OCCLUSION list("type"="drop_shadow","x"=0,"y"=-2,"size"=4,"color"="#04080FAA") #define EYE_BLUR(size) list("type"="blur", "size"=size) #define GRAVITY_MOTION_BLUR list("type"="motion_blur","x"=0,"y"=0) diff --git a/code/__DEFINES/typeids.dm b/code/__DEFINES/typeids.dm index ae5df258..8bfe6216 100644 --- a/code/__DEFINES/typeids.dm +++ b/code/__DEFINES/typeids.dm @@ -2,7 +2,7 @@ #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) diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 99cb6c54..812ced8d 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -514,7 +514,7 @@ used_key_list[input_key] = 1 return input_key -#if DM_VERSION > 512 +#if DM_VERSION > 513 #error Remie said that lummox was adding a way to get a lists #error contents via list.values, if that is true remove this #error otherwise, update the version and bug lummox diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index 351411ce..402f0c76 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -305,9 +305,9 @@ //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 @@ -327,7 +327,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++ @@ -608,8 +608,8 @@ GLOBAL_LIST_INIT(binary, list("0","1")) continue var/buffer = "" var/early_culling = TRUE - for(var/pos = 1, pos <= lentext(string), pos++) - var/let = copytext(string, pos, (pos + 1) % lentext(string)) + for(var/pos = 1, pos <= length(string), pos++) + var/let = copytext(string, pos, (pos + 1) % length(string)) if(early_culling && !findtext(let,GLOB.is_alphanumeric)) continue early_culling = FALSE @@ -617,9 +617,9 @@ GLOBAL_LIST_INIT(binary, list("0","1")) if(!findtext(buffer,GLOB.is_alphanumeric)) continue var/punctbuffer = "" - var/cutoff = lentext(buffer) - for(var/pos = lentext(buffer), pos >= 0, pos--) - var/let = copytext(buffer, pos, (pos + 1) % lentext(buffer)) + var/cutoff = length(buffer) + for(var/pos = length(buffer), pos >= 0, pos--) + var/let = copytext(buffer, pos, (pos + 1) % length(buffer)) if(findtext(let,GLOB.is_alphanumeric)) break if(findtext(let,GLOB.is_punctuation)) @@ -629,8 +629,8 @@ GLOBAL_LIST_INIT(binary, list("0","1")) var/exclaim = FALSE var/question = FALSE var/periods = 0 - for(var/pos = lentext(punctbuffer), pos >= 0, pos--) - var/punct = copytext(punctbuffer, pos, (pos + 1) % lentext(punctbuffer)) + for(var/pos = length(punctbuffer), pos >= 0, pos--) + var/punct = copytext(punctbuffer, pos, (pos + 1) % length(punctbuffer)) if(!exclaim && findtext(punct,"!")) exclaim = TRUE if(!question && findtext(punct,"?")) @@ -652,7 +652,7 @@ GLOBAL_LIST_INIT(binary, list("0","1")) buffer = copytext(buffer, 1, cutoff) + punctbuffer if(!findtext(buffer,GLOB.is_alphanumeric)) continue - if(!buffer || lentext(buffer) > 280 || lentext(buffer) <= cullshort || buffer in accepted) + if(!buffer || length(buffer) > 280 || length(buffer) <= cullshort || buffer in accepted) continue accepted += buffer diff --git a/code/__HELPERS/text_vr.dm b/code/__HELPERS/text_vr.dm index 64e13ef6..9be806fc 100644 --- a/code/__HELPERS/text_vr.dm +++ b/code/__HELPERS/text_vr.dm @@ -9,8 +9,8 @@ return t 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 diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 7e078184..1f8db38f 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -451,10 +451,15 @@ Turf and target are separate in case you want to teleport some distance from a t var/y = min(world.maxy, max(1, A.y + dy)) return locate(x,y,A.z) +#if DM_VERSION > 513 +#warn if you're getting this warning it means 513 is stable +#warn and you should remove this tidbit +#endif +#if DM_VERSION < 513 /proc/arctan(x) var/y=arcsin(x/sqrt(1+x*x)) return y - +#endif /* Gets all contents of contents and returns them all in a list. */ diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index c37c607a..6bf9930e 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -515,7 +515,7 @@ GLOBAL_LIST_EMPTY(allCasters) if(href_list["set_channel_name"]) channel_name = stripped_input(usr, "Provide a Feed Channel Name", "Network Channel Handler", "", MAX_NAME_LEN) while (findtext(channel_name," ") == 1) - channel_name = copytext(channel_name,2,lentext(channel_name)+1) + channel_name = copytext(channel_name,2,length(channel_name)+1) updateUsrDialog() else if(href_list["set_channel_lock"]) c_locked = !c_locked diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 877e320a..675c8bce 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -243,7 +243,7 @@ else line1 = "CARGO" line2 = SSshuttle.supply.getTimerStr() - if(lentext(line2) > CHARS_PER_LINE) + if(length(line2) > CHARS_PER_LINE) line2 = "Error" update_display(line1, line2) diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm index 0f3bfbeb..4c85e746 100644 --- a/code/game/objects/structures/musician.dm +++ b/code/game/objects/structures/musician.dm @@ -104,12 +104,12 @@ playing = FALSE hearing_mobs = null return - if(!lentext(note)) + if(!length(note)) 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") @@ -209,7 +209,7 @@ lines.Cut(MUSIC_MAXLINES + 1) var/linenum = 1 for(var/l in lines) - if(lentext(l) > MUSIC_MAXLINECHARS) + if(length(l) > MUSIC_MAXLINECHARS) to_chat(usr, "Line [linenum] too long!") lines.Remove(l) else @@ -236,11 +236,11 @@ if(!in_range(instrumentObj, usr)) return - if(lentext(t) >= MUSIC_MAXLINES * MUSIC_MAXLINECHARS) + if(length(t) >= MUSIC_MAXLINES * MUSIC_MAXLINECHARS) 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) > MUSIC_MAXLINES * MUSIC_MAXLINECHARS) + while(length(t) > MUSIC_MAXLINES * MUSIC_MAXLINECHARS) ParseSong(t) else if(href_list["help"]) @@ -272,7 +272,7 @@ return if(lines.len > MUSIC_MAXLINES) return - if(lentext(newline) > MUSIC_MAXLINECHARS) + if(length(newline) > MUSIC_MAXLINECHARS) newline = copytext(newline, 1, MUSIC_MAXLINECHARS) lines.Add(newline) @@ -287,7 +287,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) > MUSIC_MAXLINECHARS) + if(length(content) > MUSIC_MAXLINECHARS) content = copytext(content, 1, MUSIC_MAXLINECHARS) if(num > lines.len || num < 1) return diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index c427b277..62cb66f9 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2152,7 +2152,7 @@ return src.admincaster_feed_channel.channel_name = stripped_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"]) @@ -2194,7 +2194,7 @@ return src.admincaster_feed_message.body = adminscrub(input(usr, "Write your Feed story.", "Network Channel Handler", "")) while (findtext(src.admincaster_feed_message.returnBody(-1)," ") == 1) - src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.returnBody(-1),2,lentext(src.admincaster_feed_message.returnBody(-1))+1) + src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.returnBody(-1),2,length(src.admincaster_feed_message.returnBody(-1))+1) src.access_news_network() else if(href_list["ac_submit_new_message"]) @@ -2255,7 +2255,7 @@ return src.admincaster_wanted_message.criminal = adminscrub(input(usr, "Provide the name of the Wanted person.", "Network Security Handler", "")) while(findtext(src.admincaster_wanted_message.criminal," ") == 1) - src.admincaster_wanted_message.criminal = copytext(admincaster_wanted_message.criminal,2,lentext(admincaster_wanted_message.criminal)+1) + src.admincaster_wanted_message.criminal = copytext(admincaster_wanted_message.criminal,2,length(admincaster_wanted_message.criminal)+1) src.access_news_network() else if(href_list["ac_set_wanted_desc"]) @@ -2263,7 +2263,7 @@ return src.admincaster_wanted_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_wanted_message.body," ") == 1) - src.admincaster_wanted_message.body = copytext(src.admincaster_wanted_message.body,2,lentext(src.admincaster_wanted_message.body)+1) + src.admincaster_wanted_message.body = copytext(src.admincaster_wanted_message.body,2,length(src.admincaster_wanted_message.body)+1) src.access_news_network() else if(href_list["ac_submit_wanted"]) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 40c2cdba..6ddc75c7 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -307,11 +307,11 @@ GLOBAL_PROTECT(VVpixelmovement) // 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 @@ -534,7 +534,7 @@ GLOBAL_PROTECT(VVpixelmovement) if (prompt != "Continue") return FALSE return TRUE - + /client/proc/modify_variables(atom/O, param_var_name = null, autodetect_class = 0) if(!check_rights(R_VAREDIT)) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index d992df6f..906207c0 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -357,8 +357,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += "
"
dat += "Flavor Text" dat += "Set Examine Text" - if(lentext(features["flavor_text"]) <= 40) - if(!lentext(features["flavor_text"])) + if(length(features["flavor_text"]) <= 40) + if(!length(features["flavor_text"])) dat += "\[...\]" else dat += "[features["flavor_text"]]" diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index fefa032e..0e2e50c2 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -231,7 +231,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) var/r_val var/b_val var/g_val - var/color_format = lentext(input_color) + var/color_format = length(input_color) if(color_format == 3) r_val = hex2num(copytext(input_color, 1, 2))*16 g_val = hex2num(copytext(input_color, 2, 3))*16 diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 7232944b..f6793aa2 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -781,7 +781,7 @@ broken_plural = TRUE else var/holder = broken[1] //our one and only element - if(holder[lentext(holder)] == "s") + if(holder[length(holder)] == "s") broken_plural = TRUE //Put the items in that list into a string of text for(var/B in broken) @@ -793,7 +793,7 @@ damaged_plural = TRUE else var/holder = damaged[1] - if(holder[lentext(holder)] == "s") + if(holder[length(holder)] == "s") damaged_plural = TRUE for(var/D in damaged) damaged_message += D diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 83eca8b8..3a3dacee 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -67,8 +67,8 @@ /proc/slur(n,var/strength=50) strength = min(strength,50) 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) @@ -102,8 +102,8 @@ /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) diff --git a/code/modules/mob/say_vr.dm b/code/modules/mob/say_vr.dm index 1fc97c31..4bbeef70 100644 --- a/code/modules/mob/say_vr.dm +++ b/code/modules/mob/say_vr.dm @@ -25,7 +25,7 @@ if(flavor_text && flavor_text != "") // We are decoding and then encoding to not only get correct amount of characters, but also to prevent partial escaping characters being shown. var/msg = html_decode(replacetext(flavor_text, "\n", " ")) - if(lentext(msg) <= 40) + if(length(msg) <= 40) return "[html_encode(msg)]" else return "[html_encode(copytext(msg, 1, 37))]... More..." |