summaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-12-06 21:11:43 +0100
committerMichael Lutz <michi@icosahedron.de>2020-12-27 13:19:25 +0100
commit0c6e8a8123c9f74db757272f73adcbd8621e012d (patch)
tree626d723efa78c770f26b442efe7b36d584afe826 /src/string.cpp
parentdd138fc460dcbab37452e90ff070a31516994aa2 (diff)
downloadopenttd-0c6e8a8123c9f74db757272f73adcbd8621e012d.tar.xz
Codechange: Store file search paths as std::string.
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp
index d0de261e5..14bc926c1 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -362,6 +362,17 @@ bool strtolower(char *str)
return changed;
}
+bool strtolower(std::string &str, std::string::size_type offs)
+{
+ bool changed = false;
+ for (auto ch = str.begin() + offs; ch != str.end(); ++ch) {
+ auto new_ch = static_cast<char>(tolower(static_cast<unsigned char>(*ch)));
+ changed |= new_ch != *ch;
+ *ch = new_ch;
+ }
+ return changed;
+}
+
/**
* Only allow certain keys. You can define the filter to be used. This makes
* sure no invalid keys can get into an editbox, like BELL.