Skip to content

Commit

Permalink
Refactor to_lower_keys to a different key_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Drulikar committed Feb 22, 2024
1 parent d33cf14 commit 336ae65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions code/controllers/configuration/config_entry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#define KEY_MODE_TEXT 0
#define KEY_MODE_TYPE 1
#define KEY_MODE_TEXT_UNALTERED 2

/datum/config_entry
var/name //read-only, this is determined by the last portion of the derived entry type
Expand Down Expand Up @@ -137,7 +138,6 @@
var/key_mode
var/value_mode
var/splitter = " "
var/to_lower_keys = TRUE

/datum/config_entry/keyed_list/New()
. = ..()
Expand All @@ -155,7 +155,7 @@

if(key_pos || value_mode == VALUE_MODE_FLAG)
key_name = copytext(str_val, 1, key_pos)
if(to_lower_keys)
if(key_mode != KEY_MODE_TEXT_UNALTERED)
key_name = lowertext(key_name)
if(key_pos)
key_value = copytext(str_val, key_pos + length(str_val[key_pos]))
Expand All @@ -164,7 +164,7 @@
var/continue_check_value
var/continue_check_key
switch(key_mode)
if(KEY_MODE_TEXT)
if(KEY_MODE_TEXT, KEY_MODE_TEXT_UNALTERED)
new_key = key_name
continue_check_key = new_key
if(KEY_MODE_TYPE)
Expand Down
6 changes: 2 additions & 4 deletions code/controllers/configuration/entries/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,10 @@ This maintains a list of ip addresses that are able to bypass topic filtering.
/// Relay Ping Browser configuration
/datum/config_entry/keyed_list/connection_relay_ping
splitter = "|"
key_mode = KEY_MODE_TEXT
key_mode = KEY_MODE_TEXT_UNALTERED
value_mode = VALUE_MODE_TEXT
to_lower_keys = FALSE

/datum/config_entry/keyed_list/connection_relay_con
splitter = "|"
key_mode = KEY_MODE_TEXT
key_mode = KEY_MODE_TEXT_UNALTERED
value_mode = VALUE_MODE_TEXT
to_lower_keys = FALSE

0 comments on commit 336ae65

Please sign in to comment.