Merge pull request #607 from Carn/AdminOOCfix

Resolves an issue with sanitize_hexcolor - It now has an optional defaul...
This commit is contained in:
Pete Goodfellow
2013-05-28 16:18:40 -07:00
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -31,10 +31,11 @@
return default
/proc/sanitize_hexcolor(color, desired_format=3, include_bang=0)
/proc/sanitize_hexcolor(color, desired_format=3, include_bang=0, default)
var/bang = include_bang ? "#" : ""
if(!istext(color))
return bang + random_string(desired_format, zero_character_only)
if(default) return default
return bang + repeat_string(desired_format, "0")
var/start = 1 + (text2ascii(color,1)==35)
var/len = length(color)
@@ -47,6 +48,8 @@
if(48 to 57) . += ascii2text(ascii) //numbers 0 to 9
if(97 to 102) . += ascii2text(ascii) //letters a to f
if(65 to 70) . += ascii2text(ascii+32) //letters A to F - translates to lowercase
else return bang + random_string(desired_format, zero_character_only)
else
if(default) return default
return bang + repeat_string(desired_format, "0")
return .
+1 -1
View File
@@ -110,7 +110,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
update_preferences(needs_update) //needs_update = savefile_version if we need an update (positive integer)
//Sanitize
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
ooccolor = sanitize_hexcolor(ooccolor, 6, 1, initial(ooccolor))
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
UI_style = sanitize_inlist(UI_style, list("Midnight", "Plasmafire", "Retro"), initial(UI_style))
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))