summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-05-11 09:39:37 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-05-11 10:39:37 +0200
commit0e0c824ea75a812a99c7d329c3a4862d6beadf3b (patch)
tree5c56e055dde33d19aa5e9a27e77cf9dd7b9c9a85 /src/util
parent441740e021f48a3c4f7595711777b7655fdd5778 (diff)
downloadminetest-0e0c824ea75a812a99c7d329c3a4862d6beadf3b.tar.gz
minetest-0e0c824ea75a812a99c7d329c3a4862d6beadf3b.tar.bz2
minetest-0e0c824ea75a812a99c7d329c3a4862d6beadf3b.zip
Rework escape/pause menu (#5719)
* Rework escape/pause menu - Remove build information - Use current controls instead of default controls - Add information about the current server in place of the build information - Add text saying the game is paused to if in singleplayer mode. rework pause/escape menu * improve consistency + display server_name
Diffstat (limited to 'src/util')
-rw-r--r--src/util/string.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/string.h b/src/util/string.h
index 632dd4d7e..cc278da13 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -423,6 +423,18 @@ inline void str_replace(std::string &str, const std::string &pattern,
}
/**
+ * Escapes characters [ ] \ , ; that can not be used in formspecs
+ */
+inline void str_formspec_escape(std::string &str)
+{
+ str_replace(str, "\\", "\\\\");
+ str_replace(str, "]", "\\]");
+ str_replace(str, "[", "\\[");
+ str_replace(str, ";", "\\;");
+ str_replace(str, ",", "\\,");
+}
+
+/**
* Replace all occurrences of the character \p from in \p str with \p to.
*
* @param str The string to (potentially) modify.