From 386f99a8e41624761eb9c20f2b203729757bb364 Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Thu, 18 Nov 2021 04:40:58 +0300 Subject: [PATCH 001/108] Feat: add cyrillic support --- SQL/tgmc-schema.sql | 36 +++---- code/__DEFINES/__game.dm | 2 +- code/__DEFINES/admin.dm | 2 +- code/__DEFINES/text.dm | 6 +- code/__DEFINES/tgui.dm | 2 +- code/__DEFINES/typeids.dm | 2 +- code/__HELPERS/_string_lists.dm | 2 +- code/__HELPERS/chat.dm | 6 +- code/__HELPERS/files.dm | 6 +- code/__HELPERS/icons.dm | 4 +- code/__HELPERS/pencode.dm | 90 +++++++++--------- code/__HELPERS/shell.dm | 6 +- code/__HELPERS/text.dm | 93 ++++++++++--------- code/__HELPERS/type2type.dm | 34 +++---- code/__HELPERS/unsorted.dm | 8 +- code/__HELPERS/view.dm | 2 +- code/_globalvars/admin.dm | 2 +- code/_onclick/hud/movable_screen_objects.dm | 6 +- .../controllers/configuration/config_entry.dm | 8 +- .../configuration/configuration.dm | 26 +++--- .../configuration/entries/comms.dm | 4 +- .../configuration/entries/resources.dm | 4 +- code/controllers/globals.dm | 4 +- code/controllers/subsystem/codex.dm | 8 +- code/controllers/subsystem/dbcore.dm | 6 +- code/controllers/subsystem/mapping.dm | 4 +- code/controllers/subsystem/persistence.dm | 6 +- code/controllers/subsystem/points.dm | 6 +- code/controllers/subsystem/stickyban.dm | 8 +- code/datums/browser.dm | 2 +- code/datums/changelog/changelog.dm | 2 +- code/datums/chatmessage.dm | 4 +- code/datums/datacore.dm | 4 +- code/datums/emotes.dm | 16 ++-- code/datums/fluff_emails.dm | 10 +- code/datums/greyscale/_greyscale_config.dm | 2 +- code/datums/helper_datums/getrev.dm | 2 +- code/datums/loadout/loadout_manager.dm | 2 +- code/datums/shuttles.dm | 4 +- code/datums/verbs.dm | 6 +- code/datums/wires/_wires.dm | 2 +- code/game/atoms.dm | 4 +- code/game/objects/items/books/manuals.dm | 42 ++++----- .../game/objects/items/explosives/bombvest.dm | 2 +- .../objects/items/implants/implant_chem.dm | 2 +- .../items/implants/implant_neurostim.dm | 2 +- .../items/reagent_containers/food/sandwich.dm | 2 +- .../objects/items/reagent_containers/glass.dm | 2 +- .../items/reagent_containers/hypospray.dm | 2 +- code/game/objects/items/storage/belt.dm | 2 +- code/game/objects/items/storage/storage.dm | 4 +- code/game/objects/items/tools/misc_tools.dm | 2 +- code/game/objects/items/weapons/twohanded.dm | 4 +- code/game/objects/machinery/camera/camera.dm | 4 +- .../machinery/camera/camera_assembly.dm | 2 +- .../game/objects/machinery/computer/arcade.dm | 2 +- .../machinery/computer/area_air_control.dm | 2 +- .../machinery/computer/communications.dm | 6 +- .../objects/machinery/computer/computer.dm | 2 +- .../machinery/computer/dropship_weapons.dm | 6 +- .../machinery/computer/marines_consoles.dm | 12 +-- .../objects/machinery/computer/medical.dm | 2 +- .../objects/machinery/computer/security.dm | 2 +- .../game/objects/machinery/computer/skills.dm | 4 +- code/game/objects/machinery/overwatch.dm | 2 +- .../telecomms/machine_interactions.dm | 4 +- code/game/objects/structures/barsign.dm | 2 +- code/game/objects/structures/door_assembly.dm | 2 +- code/game/objects/structures/morgue.dm | 2 +- code/game/objects/structures/noticeboard.dm | 4 +- code/game/say.dm | 2 +- code/game/verbs/ooc.dm | 26 +++--- code/game/world.dm | 4 +- code/modules/admin/SDQL2/SDQL_2.dm | 28 +++--- code/modules/admin/SDQL2/SDQL_2_parser.dm | 6 +- code/modules/admin/SDQL2/SDQL_2_wrappers.dm | 4 +- code/modules/admin/admin_ranks.dm | 6 +- code/modules/admin/admin_verbs.dm | 12 +-- code/modules/admin/debug_verbs.dm | 4 +- code/modules/admin/fun_verbs.dm | 4 +- code/modules/admin/panels/game_panel.dm | 18 ++-- code/modules/admin/panels/permission_panel.dm | 4 +- code/modules/admin/panels/player_panel.dm | 2 +- code/modules/admin/stickyban.dm | 10 +- code/modules/admin/topic.dm | 8 +- code/modules/admin/verbs/adminhelp.dm | 8 +- code/modules/admin/verbs/chat_commands.dm | 4 +- code/modules/admin/verbs/datumvars.dm | 10 +- code/modules/admin/verbs/legacy.dm | 10 +- code/modules/admin/verbs/map_template.dm | 2 +- code/modules/admin/verbs/varedit.dm | 22 ++--- code/modules/admin/verbs/whitelist.dm | 2 +- .../view_variables/greyscale_modify_menu.dm | 2 +- code/modules/assembly/voice.dm | 2 +- .../modules/asset_cache/asset_cache_client.dm | 2 +- code/modules/asset_cache/asset_cache_item.dm | 4 +- .../transports/webroot_transport.dm | 10 +- code/modules/balloon_alert/balloon_alert.dm | 2 +- code/modules/client/client_procs.dm | 8 +- code/modules/client/preferences_ui.dm | 4 +- code/modules/codex/codex_client.dm | 2 +- .../modules/detectivework/scanning_console.dm | 12 +-- code/modules/emoji/emoji_parse.dm | 22 ++--- code/modules/error_handler/error_handler.dm | 16 ++-- code/modules/flufftext/Hallucination.dm | 12 +-- code/modules/instruments/songs/editor.dm | 10 +- code/modules/instruments/songs/play_legacy.dm | 10 +- .../instruments/songs/play_synthesized.dm | 10 +- code/modules/keybindings/setup.dm | 2 +- code/modules/mapping/reader.dm | 52 +++++------ code/modules/mapping/verify.dm | 2 +- code/modules/mob/emote.dm | 6 +- .../mob/living/carbon/human/species.dm | 4 +- .../mob/living/carbon/human/update_icons.dm | 4 +- .../mob/living/carbon/xenomorph/say.dm | 4 +- code/modules/mob/living/say.dm | 8 +- code/modules/mob/living/silicon/ai/say.dm | 2 +- .../modules/mob/living/silicon/decoy/decoy.dm | 2 +- code/modules/mob/living/silicon/say.dm | 2 +- code/modules/mob/mob_helpers.dm | 20 ++-- code/modules/mob/new_player/poll.dm | 4 +- code/modules/mob/say.dm | 6 +- code/modules/paperwork/carbonpaper.dm | 4 +- code/modules/paperwork/clipboard.dm | 4 +- code/modules/paperwork/filingcabinet.dm | 2 +- code/modules/paperwork/folders.dm | 4 +- code/modules/paperwork/paper.dm | 40 ++++---- code/modules/paperwork/paper_bundle.dm | 6 +- code/modules/paperwork/photocopier.dm | 4 +- code/modules/paperwork/photography.dm | 2 +- code/modules/power/pipecleaners.dm | 6 +- code/modules/power/power_monitor.dm | 2 +- code/modules/projectiles/gun_helpers.dm | 2 +- code/modules/projectiles/sentries.dm | 2 +- code/modules/screen_alert/_screen_alert.dm | 6 +- code/modules/shuttle/cas_plane.dm | 4 +- code/modules/shuttle/mini_dropship.dm | 2 +- code/modules/tgs/core/tgs_version.dm | 4 +- code/modules/tgs/v3210/api.dm | 18 ++-- code/modules/tgs/v3210/commands.dm | 4 +- code/modules/tgs/v4/commands.dm | 2 +- code/modules/tgs/v5/commands.dm | 2 +- code/modules/tgui/tgui.dm | 4 +- code/modules/tgui/tgui_input_list.dm | 2 +- code/modules/tgui/tgui_window.dm | 6 +- code/modules/tgui_panel/audio.dm | 2 +- code/modules/tooltip/tooltip.dm | 4 +- interface/menu.dm | 4 +- 148 files changed, 582 insertions(+), 581 deletions(-) diff --git a/SQL/tgmc-schema.sql b/SQL/tgmc-schema.sql index a385c8ffbb95e..1885ba0c574cd 100644 --- a/SQL/tgmc-schema.sql +++ b/SQL/tgmc-schema.sql @@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS `admin` ( `ckey` varchar(32) NOT NULL, `rank` varchar(32) NOT NULL, PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.admin_log @@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS `admin_log` ( `target` varchar(32) NOT NULL, `log` varchar(1000) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.admin_ranks @@ -40,7 +40,7 @@ CREATE TABLE IF NOT EXISTS `admin_ranks` ( `exclude_flags` smallint(5) unsigned NOT NULL, `can_edit_flags` smallint(5) unsigned NOT NULL, PRIMARY KEY (`rank`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.ban @@ -72,7 +72,7 @@ CREATE TABLE IF NOT EXISTS `ban` ( KEY `idx_ban_isbanned` (`ckey`,`role`,`unbanned_datetime`,`expiration_time`), KEY `idx_ban_isbanned_details` (`ckey`,`ip`,`computerid`,`role`,`unbanned_datetime`,`expiration_time`), KEY `idx_ban_count` (`bantime`,`a_ckey`,`applies_to_admins`,`unbanned_datetime`,`expiration_time`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.connection_log @@ -86,7 +86,7 @@ CREATE TABLE IF NOT EXISTS `connection_log` ( `ip` int(10) unsigned NOT NULL, `computerid` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.death @@ -117,7 +117,7 @@ CREATE TABLE IF NOT EXISTS `death` ( `last_words` varchar(255) DEFAULT NULL, `suicide` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.feedback @@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS `feedback` ( `key_type` enum('text','amount','tally','nested tally','associative') NOT NULL, `json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.messages @@ -157,7 +157,7 @@ CREATE TABLE IF NOT EXISTS `messages` ( KEY `idx_msg_ckey_time` (`targetckey`,`timestamp`,`deleted`), KEY `idx_msg_type_ckeys_time` (`type`,`targetckey`,`adminckey`,`timestamp`,`deleted`), KEY `idx_msg_type_ckey_time_odr` (`type`,`targetckey`,`timestamp`,`deleted`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.player @@ -176,7 +176,7 @@ CREATE TABLE IF NOT EXISTS `player` ( PRIMARY KEY (`ckey`), KEY `idx_player_cid_ckey` (`computerid`,`ckey`), KEY `idx_player_ip_ckey` (`ip`,`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.poll_option @@ -193,7 +193,7 @@ CREATE TABLE IF NOT EXISTS `poll_option` ( `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_pop_pollid` (`pollid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.poll_question @@ -216,7 +216,7 @@ CREATE TABLE IF NOT EXISTS `poll_question` ( KEY `idx_pquest_question_time_ckey` (`question`,`starttime`,`endtime`,`createdby_ckey`,`createdby_ip`), KEY `idx_pquest_time_deleted_id` (`starttime`,`endtime`, `deleted`, `id`), KEY `idx_pquest_id_time_type_admin` (`id`,`starttime`,`endtime`,`polltype`,`adminonly`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.poll_textreply @@ -231,7 +231,7 @@ CREATE TABLE IF NOT EXISTS `poll_textreply` ( `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_ptext_pollid_ckey` (`pollid`,`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.poll_vote @@ -248,7 +248,7 @@ CREATE TABLE IF NOT EXISTS `poll_vote` ( PRIMARY KEY (`id`), KEY `idx_pvote_pollid_ckey` (`pollid`,`ckey`), KEY `idx_pvote_optionid_ckey` (`optionid`,`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.role_time @@ -257,7 +257,7 @@ CREATE TABLE IF NOT EXISTS `role_time` ( `job` varchar(32) NOT NULL, `minutes` int(10) unsigned NOT NULL, PRIMARY KEY (`ckey`,`job`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.role_time_log @@ -271,7 +271,7 @@ CREATE TABLE IF NOT EXISTS `role_time_log` ( KEY `ckey` (`ckey`), KEY `job` (`job`), KEY `datetime` (`datetime`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.round @@ -289,7 +289,7 @@ CREATE TABLE IF NOT EXISTS `round` ( `end_state` varchar(64) DEFAULT NULL, `map_name` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.schema_revision @@ -298,7 +298,7 @@ CREATE TABLE IF NOT EXISTS `schema_revision` ( `minor` tinyint(3) unsigned NOT NULL, `date` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`major`,`minor`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Data exporting was unselected. -- Dumping structure for table feedback.stickyban @@ -308,7 +308,7 @@ CREATE TABLE IF NOT EXISTS `stickyban` ( `banning_admin` varchar(32) NOT NULL, `datetime` datetime NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Table structure for table `stickyban_matched_ckey` diff --git a/code/__DEFINES/__game.dm b/code/__DEFINES/__game.dm index bf49c273310c1..6d7d7003ee50c 100644 --- a/code/__DEFINES/__game.dm +++ b/code/__DEFINES/__game.dm @@ -94,7 +94,7 @@ /// Is something in the IC chat filter? This is config dependent. -#define CHAT_FILTER_CHECK(text) (config.ic_filter_regex && findtext(text, config.ic_filter_regex)) +#define CHAT_FILTER_CHECK(text) (config.ic_filter_regex && findtext_char(text, config.ic_filter_regex)) //for whether AI eyes see static, and whether it is mouse-opaque or not #define USE_STATIC_NONE 0 diff --git a/code/__DEFINES/admin.dm b/code/__DEFINES/admin.dm index 8d17ed104913a..4323d6a5f5b62 100644 --- a/code/__DEFINES/admin.dm +++ b/code/__DEFINES/admin.dm @@ -77,7 +77,7 @@ #define ROUNDSTART_LOGOUT_REPORT_TIME 10 MINUTES //Amount of time (in deciseconds) after the rounds starts, that the player disconnect report is issued. #define SPAM_TRIGGER_TIME_PERIOD 10 SECONDS //The time period for checking spammy messages -#define SPAM_TRIGGER_WEIGHT_FORMULA(message) length(message) / 200 +#define SPAM_TRIGGER_WEIGHT_FORMULA(message) length_char(message) / 200 #define SPAM_TRIGGER_WARNING 7 //Number of messages required per the time period before the spam-prevention will warn you #define SPAM_TRIGGER_AUTOMUTE 10 //Number of messages required per the time period before the spam-prevention will automute you #define SPAM_TRIGGER_WEIGHT_WARNING 2.5 //The weight required per the time period before the spam-prevention will warn you diff --git a/code/__DEFINES/text.dm b/code/__DEFINES/text.dm index 58ab98b132b26..ea99d080dba71 100644 --- a/code/__DEFINES/text.dm +++ b/code/__DEFINES/text.dm @@ -2,10 +2,10 @@ #define MAPTEXT(text) {"[##text]"} /// Macro from Lummox used to get height from a MeasureText proc -#define WXH_TO_HEIGHT(x) text2num(copytext(x, findtextEx(x, "x") + 1)) +#define WXH_TO_HEIGHT(x) text2num(copytext_char(x, findtextEx_char(x, "x") + 1)) /// Removes characters incompatible with file names. -#define SANITIZE_FILENAME(text) (GLOB.filename_forbidden_chars.Replace(text, "")) +#define SANITIZE_FILENAME(text) (GLOB.filename_forbidden_chars.Replace_char(text, "")) /// Simply removes the < and > characters, and limits the length of the message. -#define STRIP_HTML_SIMPLE(text, limit) (GLOB.angular_brackets.Replace(copytext(text, 1, limit), "")) +#define STRIP_HTML_SIMPLE(text, limit) (GLOB.angular_brackets.Replace_char(copytext_char(text, 1, limit), "")) diff --git a/code/__DEFINES/tgui.dm b/code/__DEFINES/tgui.dm index 126266d6b7580..5200e3ea0ec10 100644 --- a/code/__DEFINES/tgui.dm +++ b/code/__DEFINES/tgui.dm @@ -27,7 +27,7 @@ /// Get a window id based on the provided pool index #define TGUI_WINDOW_ID(index) "tgui-window-[index]" /// Get a pool index of the provided window id -#define TGUI_WINDOW_INDEX(window_id) text2num(copytext(window_id, 13)) +#define TGUI_WINDOW_INDEX(window_id) text2num(copytext_char(window_id, 13)) /// Creates a message packet for sending via output() // This is {"type":type,"payload":payload}, but pre-encoded. This is much faster diff --git a/code/__DEFINES/typeids.dm b/code/__DEFINES/typeids.dm index 6ee99f62a0563..0394a4ef70966 100644 --- a/code/__DEFINES/typeids.dm +++ b/code/__DEFINES/typeids.dm @@ -2,5 +2,5 @@ #define TYPEID_NULL "0" #define TYPEID_NORMAL_LIST "f" //helper macros -#define GET_TYPEID(ref) ( ( (length(ref) <= 10) ? "TYPEID_NULL" : copytext(ref, 4, -7) ) ) +#define GET_TYPEID(ref) ( ( (length_char(ref) <= 10) ? "TYPEID_NULL" : copytext_char(ref, 4, -7) ) ) // does it need _char suffix? #define IS_NORMAL_LIST(L) (GET_TYPEID("\ref[L]") == TYPEID_NORMAL_LIST) diff --git a/code/__HELPERS/_string_lists.dm b/code/__HELPERS/_string_lists.dm index 766ea9e5c22a5..5bac67292b0b9 100644 --- a/code/__HELPERS/_string_lists.dm +++ b/code/__HELPERS/_string_lists.dm @@ -12,7 +12,7 @@ GLOBAL_VAR(string_filename_current_key) if((filename in GLOB.string_cache) && (key in GLOB.string_cache[filename])) var/response = pick(GLOB.string_cache[filename][key]) var/regex/r = regex("@pick\\((\\D+?)\\)", "g") - response = r.Replace(response, /proc/strings_subkey_lookup) + response = r.Replace_char(response, /proc/strings_subkey_lookup) return response else CRASH("strings list not found: [directory]/[filename], index=[key]") diff --git a/code/__HELPERS/chat.dm b/code/__HELPERS/chat.dm index 2a546370ec0e1..0614b201c140e 100644 --- a/code/__HELPERS/chat.dm +++ b/code/__HELPERS/chat.dm @@ -53,7 +53,7 @@ In TGS3 it will always be sent to all connected designated game chats. var/list/channels_to_use = list() for(var/I in world.TgsChatChannelInfo()) var/datum/tgs_chat_channel/channel = I - var/list/applicable_tags = splittext(channel.custom_tag, ",") + var/list/applicable_tags = splittext_char(channel.custom_tag, ",") if(channel_tag in applicable_tags) channels_to_use += channel @@ -67,6 +67,6 @@ In TGS3 it will always be sent to all connected designated game chats. * message - The message to send. */ /proc/send2adminchat(category, message) - category = replacetext(replacetext(category, "\proper", ""), "\improper", "") - message = replacetext(replacetext(message, "\proper", ""), "\improper", "") + category = replacetext_char(replacetext_char(category, "\proper", ""), "\improper", "") + message = replacetext_char(replacetext_char(message, "\proper", ""), "\improper", "") world.TgsTargetedChatBroadcast("[category] | [message]", TRUE) diff --git a/code/__HELPERS/files.dm b/code/__HELPERS/files.dm index 44c320a7a422e..77e9699090734 100644 --- a/code/__HELPERS/files.dm +++ b/code/__HELPERS/files.dm @@ -27,7 +27,7 @@ extensions += "|" extensions += "[i]" var/regex/valid_ext = new("\\.([extensions])$", "i") - if( !fexists(path) || !(valid_ext.Find(path)) ) + if( !fexists(path) || !(valid_ext.Find_char(path)) ) to_chat(src, "Error: browse_files(): File not found/Invalid file([path]).") return return path @@ -57,14 +57,14 @@ var/list/new_filenames = flist(current_dir) for(var/new_filename in new_filenames) // if filename ends in / it is a directory, append to currdir - if(findtext(new_filename, "/", -1)) + if(findtext_char(new_filename, "/", -1)) jobs += current_dir + new_filename else filenames += current_dir + new_filename return filenames /proc/pathflatten(path) - return replacetext(path, "/", "_") + return replacetext_char(path, "/", "_") //Sends resource files to client cache diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 37986c45c7aff..1a2571a12ff81 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -950,8 +950,8 @@ ColorTone(rgb, tone) var/savefile/dummySave = new("tmp/dummySave.sav") WRITE_FILE(dummySave["dummy"], icon) var/iconData = dummySave.ExportText("dummy") - var/list/partial = splittext(iconData, "{") - . = replacetext(copytext_char(partial[2], 3, -5), "\n", "") //if cleanup fails we want to still return the correct base64 + var/list/partial = splittext_char(iconData, "{") + . = replacetext_char(copytext_char(partial[2], 3, -5), "\n", "") //if cleanup fails we want to still return the correct base64 dummySave.Unlock() dummySave = null fdel("tmp/dummySave.sav") //if you get the idea to try and make this more optimized, make sure to still call unlock on the savefile after every write to unlock it. diff --git a/code/__HELPERS/pencode.dm b/code/__HELPERS/pencode.dm index d671001822ee2..793ff491bc8df 100644 --- a/code/__HELPERS/pencode.dm +++ b/code/__HELPERS/pencode.dm @@ -11,51 +11,51 @@ GLOBAL_LIST_INIT(pencode_blocked_tags, list("*", "hr", "small", "/small", "list" if(is_crayon) // Remove all the blocked tags. for(var/i in GLOB.pencode_blocked_tags) - t = replacetext(t, "\[[i]\]", "") - - t = replacetext(t, "\n", "
") // Lets just always do this one - - t = replacetext(t, "\[br\]", "
") - t = replacetext(t, "\[hr\]", "
") - t = replacetext(t, "\[center\]", "
") - t = replacetext(t, "\[/center\]", "
") - t = replacetext(t, "\[b\]", "") - t = replacetext(t, "\[/b\]", "") - t = replacetext(t, "\[i\]", "") - t = replacetext(t, "\[/i\]", "") - t = replacetext(t, "\[u\]", "") - t = replacetext(t, "\[/u\]", "") - - t = replacetext(t, "\[large\]", "") - t = replacetext(t, "\[/large\]", "") - t = replacetext(t, "\[small\]", "") - t = replacetext(t, "\[/small\]", "") - t = replacetext(t, "\[h1\]", "

") - t = replacetext(t, "\[/h1\]", "

") - t = replacetext(t, "\[h2\]", "

") - t = replacetext(t, "\[/h2\]", "

") - t = replacetext(t, "\[h3\]", "

") - t = replacetext(t, "\[/h3\]", "

") - - t = replacetext(t, "\[list\]", "") - t = replacetext(t, "\[*\]", "
  • ") - t = replacetext(t, "\[table\]", "") - t = replacetext(t, "\[/table\]", "
    ") - t = replacetext(t, "\[grid\]", "") - t = replacetext(t, "\[/grid\]", "
    ") - t = replacetext(t, "\[row\]", "") - t = replacetext(t, "\[cell\]", "") - - t = replacetext(t, "\[sign\]", "[user ? user.real_name : "Anonymous"]") - t = replacetext(t, "\[field\]", "") - t = replacetext(t, "\[logo\]", "") - t = replacetext(t, "\[ntlogo\]", "") - - t = replacetext(t, "\[mapname\]", "[SSmapping.configs[GROUND_MAP].map_name]") - t = replacetext(t, "\[shipname\]", "[SSmapping.configs[SHIP_MAP].map_name]") - t = replacetext(t, "\[date\]", "[GAME_YEAR]-[time2text(world.realtime, "MM-DD")]") - t = replacetext(t, "\[time\]", "[worldtime2text()]") + t = replacetext_char(t, "\[[i]\]", "") + + t = replacetext_char(t, "\n", "
    ") // Lets just always do this one + + t = replacetext_char(t, "\[br\]", "
    ") + t = replacetext_char(t, "\[hr\]", "
    ") + t = replacetext_char(t, "\[center\]", "
    ") + t = replacetext_char(t, "\[/center\]", "
    ") + t = replacetext_char(t, "\[b\]", "") + t = replacetext_char(t, "\[/b\]", "") + t = replacetext_char(t, "\[i\]", "") + t = replacetext_char(t, "\[/i\]", "") + t = replacetext_char(t, "\[u\]", "") + t = replacetext_char(t, "\[/u\]", "") + + t = replacetext_char(t, "\[large\]", "") + t = replacetext_char(t, "\[/large\]", "") + t = replacetext_char(t, "\[small\]", "") + t = replacetext_char(t, "\[/small\]", "") + t = replacetext_char(t, "\[h1\]", "

    ") + t = replacetext_char(t, "\[/h1\]", "

    ") + t = replacetext_char(t, "\[h2\]", "

    ") + t = replacetext_char(t, "\[/h2\]", "

    ") + t = replacetext_char(t, "\[h3\]", "

    ") + t = replacetext_char(t, "\[/h3\]", "

    ") + + t = replacetext_char(t, "\[list\]", "") + t = replacetext_char(t, "\[*\]", "
  • ") + t = replacetext_char(t, "\[table\]", "") + t = replacetext_char(t, "\[/table\]", "
    ") + t = replacetext_char(t, "\[grid\]", "") + t = replacetext_char(t, "\[/grid\]", "
    ") + t = replacetext_char(t, "\[row\]", "") + t = replacetext_char(t, "\[cell\]", "") + + t = replacetext_char(t, "\[sign\]", "[user ? user.real_name : "Anonymous"]") + t = replacetext_char(t, "\[field\]", "") + t = replacetext_char(t, "\[logo\]", "") + t = replacetext_char(t, "\[ntlogo\]", "") + + t = replacetext_char(t, "\[mapname\]", "[SSmapping.configs[GROUND_MAP].map_name]") + t = replacetext_char(t, "\[shipname\]", "[SSmapping.configs[SHIP_MAP].map_name]") + t = replacetext_char(t, "\[date\]", "[GAME_YEAR]-[time2text(world.realtime, "MM-DD")]") + t = replacetext_char(t, "\[time\]", "[worldtime2text()]") t = "[t]" diff --git a/code/__HELPERS/shell.dm b/code/__HELPERS/shell.dm index 3ba526b2e9924..e626a464d27d8 100644 --- a/code/__HELPERS/shell.dm +++ b/code/__HELPERS/shell.dm @@ -25,7 +25,7 @@ out_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_OUT]" err_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_ERR]" if(world.system_type == UNIX) - errorcode = shell("[interpreter] \"[replacetext(command, "\"", "\\\"")]\" > [out_file] 2> [err_file]") + errorcode = shell("[interpreter] \"[replacetext_char(command, "\"", "\\\"")]\" > [out_file] 2> [err_file]") else errorcode = shell("[interpreter] \"[command]\" > [out_file] 2> [err_file]") if(fexists(out_file)) @@ -50,8 +50,8 @@ var/last_good = 1 var/bad_chars = 1 do - bad_chars = bad_chars_regex.Find(url) - scrubbed_url += copytext(url, last_good, bad_chars) + bad_chars = bad_chars_regex.Find_char(url) + scrubbed_url += copytext_char(url, last_good, bad_chars) if(bad_chars) bad_match = url_encode(bad_chars_regex.match) scrubbed_url += bad_match diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index d7301cc65ded1..32f8f89b69c72 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -1,4 +1,4 @@ -#define strip_improper(input_text) replacetext(replacetext(input_text, "\proper", ""), "\improper", "") +#define strip_improper(input_text) replacetext_char(replacetext_char(input_text, "\proper", ""), "\improper", "") @@ -9,17 +9,17 @@ /proc/readd_quotes(t) var/list/repl_chars = list(""" = "\"", "'" = "\"") for(var/char in repl_chars) - var/index = findtext(t, char) + var/index = findtext_char(t, char) while(index) - t = copytext(t, 1, index) + repl_chars[char] + copytext(t, index + 5) - index = findtext(t, char) + t = copytext_char(t, 1, index) + repl_chars[char] + copytext_char(t, index + 5) + index = findtext_char(t, char) return t /// Runs byond's html encoding sanitization proc, after replacing new-lines and tabs for the # character. /proc/sanitize(text) var/static/regex/regex = regex(@"[\n\t]", "g") - return html_encode(regex.Replace(text, "#")) + return html_encode(regex.Replace_char(text, "#")) /// Runs STRIP_HTML_SIMPLE and sanitize. @@ -44,18 +44,18 @@ * */ /proc/reject_bad_text(text, max_length = 512, ascii_only = TRUE) if(ascii_only) - if(length(text) > max_length) + if(length_char(text) > max_length) return null var/static/regex/non_ascii = regex(@"[^\x20-\x7E\t\n]") - if(non_ascii.Find(text)) + if(non_ascii.Find_char(text)) return null else if(length_char(text) > max_length) return null var/static/regex/non_whitespace = regex(@"\S") - if(!non_whitespace.Find(text)) + if(!non_whitespace.Find_char(text)) return null var/static/regex/bad_chars = regex(@"[\\<>/\x00-\x08\x11-\x1F]") - if(bad_chars.Find(text)) + if(bad_chars.Find_char(text)) return null return text @@ -65,7 +65,7 @@ /proc/stripped_input(mob/user, message = "", title = "", default = "", max_length = MAX_MESSAGE_LEN, no_trim = FALSE) var/name = input(user, message, title, default) as text|null if(no_trim) - return copytext(html_encode(name), 1, max_length) + return copytext_char(html_encode(name), 1, max_length) else return trim(html_encode(name), max_length) //trim is "outside" because html_encode can expand single symbols into multiple symbols (such as turning < into <) @@ -73,7 +73,7 @@ /proc/stripped_multiline_input(mob/user, message = "", title = "", default = "", max_length=MAX_MESSAGE_LEN, no_trim=FALSE) var/name = input(user, message, title, default) as message|null if(no_trim) - return copytext(html_encode(name), 1, max_length) + return copytext_char(html_encode(name), 1, max_length) else return trim(html_encode(name), max_length) @@ -92,15 +92,15 @@ var/number_of_alphanumeric = 0 var/last_char_group = NO_CHARS_DETECTED var/t_out = "" - var/t_len = length(t_in) + var/t_len = length_char(t_in) var/charcount = 0 var/char = "" - for(var/i = 1, i <= t_len, i += length(char)) + for(var/i = 1, i <= t_len, i += length_char(char)) char = t_in[i] - switch(text2ascii(char)) + switch(text2ascii_char(char)) // A .. Z if(65 to 90) //Uppercase Letters number_of_alphanumeric++ @@ -184,18 +184,18 @@ //Returns a string with reserved characters and spaces before the first letter removed /proc/trim_left(text) - for(var/i in 1 to length(text)) - if(text2ascii(text, i) <= 32) + for(var/i in 1 to length_char(text)) + if(text2ascii_char(text, i) <= 32) continue - return copytext(text, i) + return copytext_char(text, i) return "" //Returns a string with reserved characters and spaces after the last letter removed /proc/trim_right(text) - for(var/i = length(text), i > 0, i--) - if(text2ascii(text, i) > 32) - return copytext(text, 1, i + 1) + for(var/i = length_char(text), i > 0, i--) + if(text2ascii_char(text, i) > 32) + return copytext_char(text, 1, i + 1) return "" @@ -211,7 +211,7 @@ . = t if(t) . = t[1] - return uppertext(.) + copytext(t, 1 + length(.)) + return uppertext(.) + copytext_char(t, 1 + length_char(.)) /proc/stringmerge(text,compare,replace = "*") @@ -222,8 +222,8 @@ var/text_it = 1 //iterators var/comp_it = 1 var/newtext_it = 1 - var/text_length = length(text) - var/comp_length = length(compare) + var/text_length = length_char(text) + var/comp_length = length_char(compare) while(comp_it <= comp_length && text_it <= text_length) var/a = text[text_it] var/b = compare[comp_it] @@ -231,14 +231,14 @@ //(no way to know what it was supposed to be) if(a != b) if(a == replace) //if A is the replacement char - newtext = copytext(newtext, 1, newtext_it) + b + copytext(newtext, newtext_it + length(newtext[newtext_it])) + newtext = copytext_char(newtext, 1, newtext_it) + b + copytext_char(newtext, newtext_it + length_char(newtext[newtext_it])) else if(b == replace) //if B is the replacement char - newtext = copytext(newtext, 1, newtext_it) + a + copytext(newtext, newtext_it + length(newtext[newtext_it])) + newtext = copytext_char(newtext, 1, newtext_it) + a + copytext_char(newtext, newtext_it + length_char(newtext[newtext_it])) else //The lists disagree, Uh-oh! return 0 - text_it += length(a) - comp_it += length(b) - newtext_it += length(newtext[newtext_it]) + text_it += length_char(a) + comp_it += length_char(b) + newtext_it += length_char(newtext[newtext_it]) return newtext @@ -249,9 +249,9 @@ if(!text || !character) return 0 var/count = 0 - var/lentext = length(text) + var/lentext = length_char(text) var/a = "" - for(var/i = 1, i <= lentext, i += length(a)) + for(var/i = 1, i <= lentext, i += length_char(a)) a = text[i] if(a == character) count++ @@ -266,38 +266,39 @@ //Used in preferences' SetFlavorText and human's set_flavor verb //Previews a string of len or less length +// TODO: check length /proc/TextPreview(string, length = 40) if(length_char(string) > length(string)) if(length_char(string) > length) return "[copytext_char(string, 1, 37)]..." - if(!length(string)) + if(!length_char(string)) return "\[...\]" return string - if(!length(string)) + if(!length_char(string)) return "\[...\]" - if(length(string) > length) - return "[copytext(string, 1, 37)]..." + if(length_char(string) > length) + return "[copytext_char(string, 1, 37)]..." return string //Used for applying byonds text macros to strings that are loaded at runtime /proc/apply_text_macros(string) - var/next_backslash = findtext(string, "\\") + var/next_backslash = findtext_char(string, "\\") if(!next_backslash) return string - var/leng = length(string) + var/leng = length_char(string) - var/next_space = findtext(string, " ", next_backslash + length(string[next_backslash])) + var/next_space = findtext_char(string, " ", next_backslash + length_char(string[next_backslash])) if(!next_space) next_space = leng - next_backslash if(!next_space) //trailing bs return string - var/base = next_backslash == 1 ? "" : copytext(string, 1, next_backslash) - var/macro = lowertext(copytext(string, next_backslash + length(string[next_backslash]), next_space)) - var/rest = next_backslash > leng ? "" : copytext(string, next_space + length(string[next_space])) + var/base = next_backslash == 1 ? "" : copytext_char(string, 1, next_backslash) + var/macro = lowertext(copytext_char(string, next_backslash + length_char(string[next_backslash]), next_space)) + var/rest = next_backslash > leng ? "" : copytext_char(string, next_space + length_char(string[next_space])) //See https://secure.byond.com/docs/ref/info.html#/DM/text/macros switch(macro) @@ -349,15 +350,15 @@ GLOBAL_PROTECT(sanitize) /proc/noscript(text) for(var/i in GLOB.sanitize) - text = replacetext(text, i, "") + text = replacetext_char(text, i, "") return text /proc/sanitizediscord(text) - text = replacetext(text, "\improper", "") - text = replacetext(text, "\proper", "") - text = replacetext(text, "<@", "") - text = replacetext(text, "@here", "") - text = replacetext(text, "@everyone", "") + text = replacetext_char(text, "\improper", "") + text = replacetext_char(text, "\proper", "") + text = replacetext_char(text, "<@", "") + text = replacetext_char(text, "@here", "") + text = replacetext_char(text, "@everyone", "") return text diff --git a/code/__HELPERS/type2type.dm b/code/__HELPERS/type2type.dm index 21814427d71be..6892866585c28 100644 --- a/code/__HELPERS/type2type.dm +++ b/code/__HELPERS/type2type.dm @@ -78,7 +78,7 @@ //TODO replace thise usage with the byond proc //Converts a string into a list by splitting the string at each delimiter found. (discarding the seperator) /proc/text2list(text, delimiter = "\n") - var/delim_len = length(delimiter) + var/delim_len = length_char(delimiter) if(delim_len < 1) return list(text) @@ -86,8 +86,8 @@ var/last_found = 1 var/found do - found = findtext(text, delimiter, last_found, 0) - . += copytext(text, last_found, found) + found = findtext_char(text, delimiter, last_found, 0) + . += copytext_char(text, last_found, found) last_found = found + delim_len while(found) @@ -290,8 +290,8 @@ //returns an empty list if the file doesn't exist /proc/file2list(filename, seperator = "\n", trim = TRUE) if(trim) - return splittext(trim(file2text(filename)),seperator) - return splittext(file2text(filename),seperator) + return splittext_char(trim(file2text(filename)),seperator) + return splittext_char(file2text(filename),seperator) //returns a string the last bit of a type, without the preceeding '/' @@ -313,12 +313,12 @@ if(/turf) return "turf" else //regex everything else (works for /proc too) - return lowertext(replacetext("[the_type]", "[type2parent(the_type)]/", "")) + return lowertext(replacetext_char("[the_type]", "[type2parent(the_type)]/", "")) /proc/type2parent(child) var/string_type = "[child]" - var/last_slash = findlasttext(string_type, "/") + var/last_slash = findlasttext_char(string_type, "/") if(last_slash == 1) switch(child) if(/datum) @@ -329,7 +329,7 @@ return /atom else return /datum - return text2path(copytext(string_type, 1, last_slash)) + return text2path(copytext_char(string_type, 1, last_slash)) /proc/string2listofvars(t_string, datum/var_source) @@ -338,25 +338,25 @@ . = list() - var/var_found = findtext(t_string, "\[") //Not the actual variables, just a generic "should we even bother" check + var/var_found = findtext_char(t_string, "\[") //Not the actual variables, just a generic "should we even bother" check if(var_found) //Find var names // "A dog said hi [name]!" - // splittext() --> list("A dog said hi ","name]!" + // splittext_char() --> list("A dog said hi ","name]!" // jointext() --> "A dog said hi name]!" - // splittext() --> list("A","dog","said","hi","name]!") + // splittext_char() --> list("A","dog","said","hi","name]!") - t_string = replacetext(t_string,"\[","\[ ")//Necessary to resolve "word[var_name]" scenarios - var/list/list_value = splittext(t_string,"\[") + t_string = replacetext_char(t_string,"\[","\[ ")//Necessary to resolve "word[var_name]" scenarios + var/list/list_value = splittext_char(t_string,"\[") var/intermediate_stage = jointext(list_value, null) - list_value = splittext(intermediate_stage," ") + list_value = splittext_char(intermediate_stage," ") for(var/value in list_value) - if(!findtext(value, "]")) + if(!findtext_char(value, "]")) continue - value = splittext(value, "]") //"name]!" --> list("name","!") + value = splittext_char(value, "]") //"name]!" --> list("name","!") for(var/A in value) if(!var_source.vars.Find(A)) continue @@ -381,4 +381,4 @@ /// Return html to load a url. /// for use inside of browse() calls to html assets that might be loaded on a cdn. /proc/url2htmlloader(url) - return {""} + return {""} diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 9dc4751e7f89d..20c21a79dac47 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -679,11 +679,11 @@ GLOBAL_LIST_INIT(common_tools, typecacheof(list( /proc/params2turf(scr_loc, turf/origin, client/C) if(!scr_loc || !origin) return - var/tX = splittext(scr_loc, ",") - var/tY = splittext(tX[2], ":") + var/tX = splittext_char(scr_loc, ",") + var/tY = splittext_char(tX[2], ":") var/tZ = origin.z tY = tY[1] - tX = splittext(tX[1], ":") + tX = splittext_char(tX[1], ":") tX = tX[1] var/list/actual_view = getviewsize(C ? C.view : WORLD_VIEW) tX = clamp(origin.x + text2num(tX) - round(actual_view[1] * 0.5) + (round(C?.pixel_x / 32)) - 1, 1, world.maxx) @@ -774,7 +774,7 @@ GLOBAL_LIST_INIT(wallitems, typecacheof(list( return FALSE /proc/format_text(text) - return replacetext(replacetext(text,"\proper ",""),"\improper ","") + return replacetext_char(replacetext_char(text,"\proper ",""),"\improper ","") ///Returns a string based on the weight class define used as argument /proc/weight_class_to_text(w_class) diff --git a/code/__HELPERS/view.dm b/code/__HELPERS/view.dm index b57aec16f81a9..85608ec5d94e2 100644 --- a/code/__HELPERS/view.dm +++ b/code/__HELPERS/view.dm @@ -3,7 +3,7 @@ var/totalviewrange = (view < 0 ? -1 : 1) + 2 * view return list(totalviewrange, totalviewrange) else - var/list/viewrangelist = splittext(view,"x") + var/list/viewrangelist = splittext_char(view,"x") return list(text2num(viewrangelist[1]), text2num(viewrangelist[2])) /// Returns TRUE if the atom is in the user view range. diff --git a/code/_globalvars/admin.dm b/code/_globalvars/admin.dm index 9a01b4c28ec5c..6df678853515b 100644 --- a/code/_globalvars/admin.dm +++ b/code/_globalvars/admin.dm @@ -16,7 +16,7 @@ GLOBAL_VAR_INIT(non_ascii_regex, regex("\[^\\x00-\\x7F]", "g")) GLOBAL_PROTECT(non_ascii_regex) ///Returns true if this contains text that is not ASCII -#define NON_ASCII_CHECK(text) (findtext(text, GLOB.non_ascii_regex)) +#define NON_ASCII_CHECK(text) (findtext_char(text, GLOB.non_ascii_regex)) GLOBAL_LIST_EMPTY(custom_loadouts) diff --git a/code/_onclick/hud/movable_screen_objects.dm b/code/_onclick/hud/movable_screen_objects.dm index 27fbd9ed7e68a..515f14c48ef41 100644 --- a/code/_onclick/hud/movable_screen_objects.dm +++ b/code/_onclick/hud/movable_screen_objects.dm @@ -24,13 +24,13 @@ return //Split screen-loc up into X+Pixel_X and Y+Pixel_Y - var/list/screen_loc_params = splittext(PM["screen-loc"], ",") + var/list/screen_loc_params = splittext_char(PM["screen-loc"], ",") //Split X+Pixel_X up into list(X, Pixel_X) - var/list/screen_loc_X = splittext(screen_loc_params[1],":") + var/list/screen_loc_X = splittext_char(screen_loc_params[1],":") //Split Y+Pixel_Y up into list(Y, Pixel_Y) - var/list/screen_loc_Y = splittext(screen_loc_params[2],":") + var/list/screen_loc_Y = splittext_char(screen_loc_params[2],":") if(snap2grid) //Discard Pixel Values screen_loc = "[screen_loc_X[1]],[screen_loc_Y[1]]" diff --git a/code/controllers/configuration/config_entry.dm b/code/controllers/configuration/config_entry.dm index 410075fa55d77..619bef4a1be69 100644 --- a/code/controllers/configuration/config_entry.dm +++ b/code/controllers/configuration/config_entry.dm @@ -127,7 +127,7 @@ return FALSE str_val = trim(str_val) var/list/new_list = list() - var/list/values = splittext(str_val," ") + var/list/values = splittext_char(str_val," ") for(var/I in values) var/temp = text2num(I) if(isnull(temp)) @@ -157,14 +157,14 @@ return FALSE str_val = trim(str_val) - var/key_pos = findtext(str_val, splitter) + var/key_pos = findtext_char(str_val, splitter) var/key_name = null var/key_value = null if(key_pos || value_mode == VALUE_MODE_FLAG) - key_name = lowertext(copytext(str_val, 1, key_pos)) + key_name = lowertext(copytext_char(str_val, 1, key_pos)) if(key_pos) - key_value = copytext(str_val, key_pos + length(str_val[key_pos])) + key_value = copytext_char(str_val, key_pos + length_char(str_val[key_pos])) var/new_key var/new_value var/continue_check_value diff --git a/code/controllers/configuration/configuration.dm b/code/controllers/configuration/configuration.dm index 69cf97d04bb2f..e8370d3de69b3 100644 --- a/code/controllers/configuration/configuration.dm +++ b/code/controllers/configuration/configuration.dm @@ -128,15 +128,15 @@ var/lockthis = firstchar == "@" if(lockthis) - L = copytext(L, length(firstchar) + 1) + L = copytext_char(L, length_char(firstchar) + 1) - var/pos = findtext(L, " ") + var/pos = findtext_char(L, " ") var/entry = null var/value = null if(pos) - entry = lowertext(copytext(L, 1, pos)) - value = copytext(L, pos + length(L[pos])) + entry = lowertext(copytext_char(L, 1, pos)) + value = copytext_char(L, pos + length_char(L[pos])) else entry = lowertext(L) @@ -254,16 +254,16 @@ t = trim(t) if(length(t) == 0) continue - else if(copytext(t, 1, 2) == "#") + else if(copytext_char(t, 1, 2) == "#") continue - var/pos = findtext(t, " ") + var/pos = findtext_char(t, " ") var/command = null var/data = null if(pos) - command = lowertext(copytext(t, 1, pos)) - data = copytext(t, pos + 1) + command = lowertext(copytext_char(t, 1, pos)) + data = copytext_char(t, pos + 1) else command = lowertext(t) @@ -347,16 +347,16 @@ Example config: t = trim(t) if(length(t) == 0) continue - else if(copytext(t, 1, 2) == "#") + else if(copytext_char(t, 1, 2) == "#") continue - var/pos = findtext(t, " ") + var/pos = findtext_char(t, " ") var/command = null var/data = null if(pos) - command = lowertext(copytext(t, 1, pos)) - data = copytext(t, pos + 1) + command = lowertext(copytext_char(t, 1, pos)) + data = copytext_char(t, pos + 1) else command = lowertext(t) @@ -412,7 +412,7 @@ Example config: for(var/line in file2list("[directory]/in_character_filter.txt")) if(!line) continue - if(findtextEx(line,"#",1,2)) + if(findtextEx_char(line,"#",1,2)) continue in_character_filter += REGEX_QUOTE(line) diff --git a/code/controllers/configuration/entries/comms.dm b/code/controllers/configuration/entries/comms.dm index ac4f23b3e10b3..49d853b2cb0fe 100644 --- a/code/controllers/configuration/entries/comms.dm +++ b/code/controllers/configuration/entries/comms.dm @@ -2,7 +2,7 @@ protection = CONFIG_ENTRY_HIDDEN /datum/config_entry/string/comms_key/ValidateAndSet(str_val) - return str_val != "default_pwd" && length(str_val) > 6 && ..() + return str_val != "default_pwd" && length_char(str_val) > 6 && ..() /datum/config_entry/keyed_list/cross_server key_mode = KEY_MODE_TEXT @@ -14,7 +14,7 @@ if(.) var/list/newv = list() for(var/I in config_entry_value) - newv[replacetext(I, "+", " ")] = config_entry_value[I] + newv[replacetext_char(I, "+", " ")] = config_entry_value[I] config_entry_value = newv /datum/config_entry/keyed_list/cross_server/ValidateListEntry(key_name, key_value) diff --git a/code/controllers/configuration/entries/resources.dm b/code/controllers/configuration/entries/resources.dm index c839ccc078d4d..460f2ab24013e 100644 --- a/code/controllers/configuration/entries/resources.dm +++ b/code/controllers/configuration/entries/resources.dm @@ -14,7 +14,7 @@ /datum/config_entry/string/asset_cdn_webroot/ValidateAndSet(str_var) if (!str_var || trim(str_var) == "") return FALSE - if (str_var && str_var[length(str_var)] != "/") + if (str_var && str_var[length_char(str_var)] != "/") str_var += "/" return ..(str_var) @@ -25,6 +25,6 @@ /datum/config_entry/string/asset_cdn_url/ValidateAndSet(str_var) if (!str_var || trim(str_var) == "") return FALSE - if (str_var && str_var[length(str_var)] != "/") + if (str_var && str_var[length_char(str_var)] != "/") str_var += "/" return ..(str_var) diff --git a/code/controllers/globals.dm b/code/controllers/globals.dm index 24028362171ca..8b4b8c981cc30 100644 --- a/code/controllers/globals.dm +++ b/code/controllers/globals.dm @@ -46,11 +46,11 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars) if(global_procs.len) var/list/expected_global_procs = vars - gvars_datum_in_built_vars for(var/I in global_procs) - expected_global_procs -= replacetext("[I]", "InitGlobal", "") + expected_global_procs -= replacetext_char("[I]", "InitGlobal", "") log_world("Missing procs: [expected_global_procs.Join(", ")]") for(var/I in global_procs) var/start_tick = world.time call(src, I)() var/end_tick = world.time if(end_tick - start_tick) - warning("Global [replacetext("[I]", "InitGlobal", "")] slept during initialization!") + warning("Global [replacetext_char("[I]", "InitGlobal", "")] slept during initialization!") diff --git a/code/controllers/subsystem/codex.dm b/code/controllers/subsystem/codex.dm index 1214153038694..40b3a66391cac 100644 --- a/code/controllers/subsystem/codex.dm +++ b/code/controllers/subsystem/codex.dm @@ -91,10 +91,10 @@ SUBSYSTEM_DEF(codex) results = list() for(var/entry_title in entries_by_string) var/datum/codex_entry/entry = entries_by_string[entry_title] - if(findtext(entry.display_name, searching) || \ - findtext(entry.lore_text, searching) || \ - findtext(entry.mechanics_text, searching) || \ - findtext(entry.antag_text, searching)) + if(findtext_char(entry.display_name, searching) || \ + findtext_char(entry.lore_text, searching) || \ + findtext_char(entry.mechanics_text, searching) || \ + findtext_char(entry.antag_text, searching)) results |= entry search_cache[searching] = dd_sortedObjectList(results) return search_cache[searching] diff --git a/code/controllers/subsystem/dbcore.dm b/code/controllers/subsystem/dbcore.dm index 48acf8962004c..cf461ea06ddbd 100644 --- a/code/controllers/subsystem/dbcore.dm +++ b/code/controllers/subsystem/dbcore.dm @@ -227,7 +227,7 @@ Delayed insert mode was removed in mysql 7 and only works with MyISAM type table has_question_mark[column] = TRUE for (var/column in special_columns) columns[column] = special_columns[column] - has_question_mark[column] = findtext(special_columns[column], "?") + has_question_mark[column] = findtext_char(special_columns[column], "?") // Prepare SQL query full of placeholders var/list/query_parts = list("INSERT") @@ -251,7 +251,7 @@ Delayed insert mode was removed in mysql 7 and only works with MyISAM type table query_parts += ", " if (has_question_mark[column]) var/name = "p[arguments.len]" - query_parts += replacetext(columns[column], "?", ":[name]") + query_parts += replacetext_char(columns[column], "?", ":[name]") arguments[name] = row[column] else query_parts += columns[column] @@ -335,7 +335,7 @@ Delayed insert mode was removed in mysql 7 and only works with MyISAM type table start_time = REALTIMEOFDAY Close() . = run_query(async) - var/timed_out = !. && findtext(last_error, "Operation timed out") + var/timed_out = !. && findtext_char(last_error, "Operation timed out") if(!. && log_error) log_sql("[last_error] | Query used: [sql] | Arguments: [json_encode(arguments)]") if(!async && timed_out) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 5cf1cb1340fa3..d96a0c816c889 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -255,11 +255,11 @@ SUBSYSTEM_DEF(mapping) else if (t[1] == "#") continue - var/pos = findtext(t, " ") + var/pos = findtext_char(t, " ") var/name = null if (pos) - name = lowertext(copytext(t, 1, pos)) + name = lowertext(copytext_char(t, 1, pos)) else name = lowertext(t) diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index 51e0e12263ea3..a381ecb9e4df1 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -114,9 +114,9 @@ SUBSYSTEM_DEF(persistence) /datum/controller/subsystem/persistence/proc/seasons_info_message() var/message = "" for(var/season_entry in season_progress) - var/season_name = jointext(splittext("[season_entry]", "_"), " ") - var/season_name_first_letter = uppertext(copytext(season_name, 1, 2)) - var/season_name_remainder = copytext(season_name, 2, length(season_name) + 1) + var/season_name = jointext(splittext_char("[season_entry]", "_"), " ") + var/season_name_first_letter = uppertext(copytext_char(season_name, 1, 2)) + var/season_name_remainder = copytext_char(season_name, 2, length_char(season_name) + 1) season_name = season_name_first_letter + season_name_remainder message += span_seasons_announce("[season_name] - season [season_progress[season_entry][CURRENT_SEASON_NUMBER]]
    ") message += span_season_additional_info("Title: [season_progress[season_entry][CURRENT_SEASON_NAME]]
    ") diff --git a/code/controllers/subsystem/points.dm b/code/controllers/subsystem/points.dm index 29162cc7baaad..0a4bfdbf46685 100644 --- a/code/controllers/subsystem/points.dm +++ b/code/controllers/subsystem/points.dm @@ -177,10 +177,10 @@ SUBSYSTEM_DEF(points) return if(length(ckey_shopping_cart) > 20) return - if(NON_ASCII_CHECK(reason)) - return + // if(NON_ASCII_CHECK(reason)) + // return if(length(reason) > MAX_LENGTH_REQ_REASON) - reason = copytext(reason, 1, MAX_LENGTH_REQ_REASON) + reason = copytext_char(reason, 1, MAX_LENGTH_REQ_REASON) var/list/datum/supply_order/orders = process_cart(user, ckey_shopping_cart) for(var/i in 1 to length(orders)) orders[i].reason = reason diff --git a/code/controllers/subsystem/stickyban.dm b/code/controllers/subsystem/stickyban.dm index afce95d874356..694968bf927c7 100644 --- a/code/controllers/subsystem/stickyban.dm +++ b/code/controllers/subsystem/stickyban.dm @@ -171,7 +171,7 @@ SUBSYSTEM_DEF(stickyban) var/list/sqlips = list() if (ban["keys"]) - var/list/keys = splittext(ban["keys"], ",") + var/list/keys = splittext_char(ban["keys"], ",") for (var/key in keys) var/list/sqlckey = list() sqlckey["stickyban"] = ckey @@ -180,7 +180,7 @@ SUBSYSTEM_DEF(stickyban) sqlckeys[++sqlckeys.len] = sqlckey if (ban["whitelist"]) - var/list/keys = splittext(ban["whitelist"], ",") + var/list/keys = splittext_char(ban["whitelist"], ",") for (var/key in keys) var/list/sqlckey = list() sqlckey["stickyban"] = ckey @@ -189,7 +189,7 @@ SUBSYSTEM_DEF(stickyban) sqlckeys[++sqlckeys.len] = sqlckey if (ban["computer_id"]) - var/list/cids = splittext(ban["computer_id"], ",") + var/list/cids = splittext_char(ban["computer_id"], ",") for (var/cid in cids) var/list/sqlcid = list() sqlcid["stickyban"] = ckey @@ -197,7 +197,7 @@ SUBSYSTEM_DEF(stickyban) sqlcids[++sqlcids.len] = sqlcid if (ban["IP"]) - var/list/ips = splittext(ban["IP"], ",") + var/list/ips = splittext_char(ban["IP"], ",") for (var/ip in ips) var/list/sqlip = list() sqlip["stickyban"] = ckey diff --git a/code/datums/browser.dm b/code/datums/browser.dm index 6168be1309e3c..b85683d951e5a 100644 --- a/code/datums/browser.dm +++ b/code/datums/browser.dm @@ -79,7 +79,7 @@ return {" - + [head_content] diff --git a/code/datums/changelog/changelog.dm b/code/datums/changelog/changelog.dm index 3ce51c60344cf..6a3c6a4838b44 100644 --- a/code/datums/changelog/changelog.dm +++ b/code/datums/changelog/changelog.dm @@ -26,7 +26,7 @@ var/regex/ymlRegex = regex(@"\.yml", "g") for(var/archive_file in flist("[global.config.directory]/../html/changelogs/archive/")) - var/archive_date = ymlRegex.Replace(archive_file, "") + var/archive_date = ymlRegex.Replace_char(archive_file, "") data["dates"] = list(archive_date) + data["dates"] return data diff --git a/code/datums/chatmessage.dm b/code/datums/chatmessage.dm index 3bc49632110ed..16353db4d68cf 100644 --- a/code/datums/chatmessage.dm +++ b/code/datums/chatmessage.dm @@ -110,11 +110,11 @@ // Get rid of any URL schemes that might cause BYOND to automatically wrap something in an anchor tag var/static/regex/url_scheme = new(@"[A-Za-z][A-Za-z0-9+-\.]*:\/\/", "g") - text = replacetext(text, url_scheme, "") + text = replacetext_char(text, url_scheme, "") // Reject whitespace var/static/regex/whitespace = new(@"^\s*$") - if (whitespace.Find(text)) + if (whitespace.Find_char(text)) qdel(src) return diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 9519d238f56c5..f02393de684da 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -112,8 +112,8 @@ GLOBAL_DATUM_INIT(datacore, /datum/datacore, new) even = !even dat += "" - dat = replacetext(dat, "\n", "") // so it can be placed on paper correctly - dat = replacetext(dat, "\t", "") + dat = replacetext_char(dat, "\n", "") // so it can be placed on paper correctly + dat = replacetext_char(dat, "\t", "") return dat diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index cd56939af9f91..a8ca035ee8ab1 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -53,7 +53,7 @@ if(!msg) return - var/end = copytext(msg, length(message)) + var/end = copytext_char(msg, length_char(message)) if(!(end in list("!", ".", "?", ":", "\"", "-"))) msg += "." @@ -94,12 +94,12 @@ /datum/emote/proc/replace_pronoun(mob/user, message) - if(findtext(message, "their")) - message = replacetext(message, "their", user.p_their()) - if(findtext(message, "them")) - message = replacetext(message, "them", user.p_them()) - if(findtext(message, "%s")) - message = replacetext(message, "%s", user.p_s()) + if(findtext_char(message, "their")) + message = replacetext_char(message, "their", user.p_their()) + if(findtext_char(message, "them")) + message = replacetext_char(message, "them", user.p_them()) + if(findtext_char(message, "%s")) + message = replacetext_char(message, "%s", user.p_s()) return message @@ -120,7 +120,7 @@ /datum/emote/proc/select_param(mob/user, params) - return replacetext(message_param, "%t", params) + return replacetext_char(message_param, "%t", params) /datum/emote/proc/can_run_emote(mob/user, status_check = TRUE, intentional = FALSE) diff --git a/code/datums/fluff_emails.dm b/code/datums/fluff_emails.dm index d3b5e02878e1c..056e13c3a814d 100644 --- a/code/datums/fluff_emails.dm +++ b/code/datums/fluff_emails.dm @@ -11,7 +11,7 @@ /datum/fluff_email/mainship/iwantout title = "RE: I want out.." - entry_text = {" + entry_text = {" Okay, yep, I know what you're saying. Stilettos aren't safe, you want out of my sharp stick business, and sooner or later we're going to get hung upside down from our ankles by the MPs, stuffed in a freezer in the lower decks, and tossed to the nearest military tribunal in a sack in six to eight weeks. @@ -32,7 +32,7 @@ /datum/fluff_email/mainship/thermalcloak title = "M68 Thermal Cloak.." - entry_text = {" + entry_text = {" Are you sure these things are safe, man? I just tried one on during a training exercise back at Bernice 378, took a wrong turn, and wound up on an outdoor firing range being used by another Battalion (5th "Hammerheads" I think?). Now typically, somebody would have spotted me, the range officer would have called for a ceasefire, the captain gives me a slap on the wrist, and I claim 'emotional trauma' and get served warm cookies @@ -47,7 +47,7 @@ /datum/fluff_email/mainship/snow title = "Snow? Where the hell is all the snow?" - entry_text = {" + entry_text = {" Why were we issued these damn snow uniforms in the first place? We've been around the sector almost three dozen times and we've yet to put them to use. They even issued us bulky kits to repaint our rifles, pistols and shotguns to match the cold weather gear, and masks to keep us warm. But what's the point? They're just taking up a fourth of the cargo hold, half infested with moths we picked @@ -61,7 +61,7 @@ /datum/fluff_email/mainship/hawaianpizza title = "Hawaiian Pizza in the MREs?" - entry_text = {" + entry_text = {" I swear this must have been a joke, but the other day I opened up my MRE packet to come face to face with a 'Hawaiian Pizza" packet. Of course, I had already cut the seal open (otherwise I'd have fenced it to the Damien twins from Bravo Squad and have retired by now), but the smell was horrendous! I guess pineapple just doesn't stow well. I neglected to check the date, but it must have been an old issue, @@ -79,7 +79,7 @@ /datum/fluff_email/mainship/themajor title = "The Major?" - entry_text = {" + entry_text = {" I keep forgetting what the new Major's name is. I got quizzed by one of the jackass staff officers last week about the captain's name, and I absolutely spilled my marbles. PCF Mable was watching too, and she probably thinks I've got rocks in my head. I know it's been weeks since the new captain took over, but for some reason the name keeps escaping me when it matters. Either the cryo-sleepers are juicing my diff --git a/code/datums/greyscale/_greyscale_config.dm b/code/datums/greyscale/_greyscale_config.dm index 742cb4204fdd1..8f309b909363d 100644 --- a/code/datums/greyscale/_greyscale_config.dm +++ b/code/datums/greyscale/_greyscale_config.dm @@ -157,6 +157,6 @@ /datum/greyscale_config/proc/ParseColorString(color_string) . = list() - var/list/split_colors = splittext(color_string, "#") + var/list/split_colors = splittext_char(color_string, "#") for(var/color in 2 to length(split_colors)) . += "#[split_colors[color]]" diff --git a/code/datums/helper_datums/getrev.dm b/code/datums/helper_datums/getrev.dm index e73766f42441f..ebe45bacb85fb 100644 --- a/code/datums/helper_datums/getrev.dm +++ b/code/datums/helper_datums/getrev.dm @@ -45,7 +45,7 @@ var/datum/tgs_revision_information/test_merge/tm = line var/cm = tm.head_commit var/details = ": '" + html_encode(tm.title) + "' by " + html_encode(tm.author) + " at commit " + html_encode(copytext_char(cm, 1, 11)) - if(details && findtext(details, "\[s\]") && (!usr || !usr.client.holder)) + if(details && findtext_char(details, "\[s\]") && (!usr || !usr.client.holder)) continue . += "#[tm.number][details]
    " diff --git a/code/datums/loadout/loadout_manager.dm b/code/datums/loadout/loadout_manager.dm index 33d65187757f9..0e7d5ce5fce24 100644 --- a/code/datums/loadout/loadout_manager.dm +++ b/code/datums/loadout/loadout_manager.dm @@ -87,7 +87,7 @@ var/loadout_id = params["loadout_id"] if(isnull(loadout_id)) return - var/list/items = splittext(loadout_id, "//") + var/list/items = splittext_char(loadout_id, "//") if(length(items) != 3) to_chat(ui.user, span_warning("Wrong format!")) return diff --git a/code/datums/shuttles.dm b/code/datums/shuttles.dm index bee8fa8aa5183..861ea32d91577 100644 --- a/code/datums/shuttles.dm +++ b/code/datums/shuttles.dm @@ -41,7 +41,7 @@ var/key var/list/models = cached_map.grid_models for(key in models) - if(findtext(models[key], "[/obj/docking_port/mobile]")) // Yay compile time checks + if(findtext_char(models[key], "[/obj/docking_port/mobile]")) // Yay compile time checks break // This works by assuming there will ever only be one mobile dock in a template at most for(var/i in cached_map.gridSets) @@ -50,7 +50,7 @@ for(var/line in gset.gridLines) var/xcrd = gset.xcrd for(var/j in 1 to length(line) step cached_map.key_len) - if(key == copytext(line, j, j + cached_map.key_len)) + if(key == copytext_char(line, j, j + cached_map.key_len)) port_x_offset = xcrd port_y_offset = ycrd return diff --git a/code/datums/verbs.dm b/code/datums/verbs.dm index da52e900f5b3f..9503c56055345 100644 --- a/code/datums/verbs.dm +++ b/code/datums/verbs.dm @@ -83,7 +83,7 @@ if(childlist) var/childname = "[child]" if(childname == "[child.type]") - var/list/tree = splittext(childname, "/") + var/list/tree = splittext_char(childname, "/") childname = tree[length(tree)] .[child.type] = "parent=[url_encode(type)];name=[childname]" . += childlist @@ -96,9 +96,9 @@ entry["parent"] = "[type]" entry["name"] = verbpath.desc if(verbpath.name[1] == "@") - entry["command"] = copytext(verbpath.name, length(verbpath.name[1]) + 1) + entry["command"] = copytext_char(verbpath.name, length_char(verbpath.name[1]) + 1) else - entry["command"] = replacetext(verbpath.name, " ", "-") + entry["command"] = replacetext_char(verbpath.name, " ", "-") .[verbpath] = HandleVerb(arglist(list(entry, verbpath) + args)) diff --git a/code/datums/wires/_wires.dm b/code/datums/wires/_wires.dm index 85311637f446b..3ad57311b851d 100644 --- a/code/datums/wires/_wires.dm +++ b/code/datums/wires/_wires.dm @@ -115,7 +115,7 @@ /datum/wires/proc/is_dud(wire) - return findtext(wire, WIRE_DUD_PREFIX, 1, length(WIRE_DUD_PREFIX) + 1) + return findtext_char(wire, WIRE_DUD_PREFIX, 1, length(WIRE_DUD_PREFIX) + 1) /datum/wires/proc/is_dud_color(color) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 59a3e28977f02..a4557aaa78edb 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -866,9 +866,9 @@ Proc for attack log creation, because really why not if(!LAZYACCESS(fingerprints, M.key)) LAZYSET(fingerprints, M.key, "First: [M.real_name] | [current_time] | [type] [special ? "| [special]" : ""]") else - var/laststamppos = findtext(LAZYACCESS(fingerprints, M.key), " Last: ") + var/laststamppos = findtext_char(LAZYACCESS(fingerprints, M.key), " Last: ") if(laststamppos) - LAZYSET(fingerprints, M.key, copytext(fingerprints[M.key], 1, laststamppos)) + LAZYSET(fingerprints, M.key, copytext_char(fingerprints[M.key], 1, laststamppos)) fingerprints[M.key] += " Last: [M.real_name] | [current_time] | [type] [special ? " | [special]" : ""]" return TRUE diff --git a/code/game/objects/items/books/manuals.dm b/code/game/objects/items/books/manuals.dm index 4523a6217dac7..95bb8838de0b7 100644 --- a/code/game/objects/items/books/manuals.dm +++ b/code/game/objects/items/books/manuals.dm @@ -15,7 +15,7 @@ dat = {" - + @@ -33,7 +33,7 @@ author = "Engineering Encyclopedia" // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned title = "Particle Accelerator User's Guide" - dat = {" + dat = {"