mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-17 21:53:35 -04:00
Race Integrity QoL (#3445)
* Add gDisableChangingSettings * Add support for dropping a config file to overwrite CVars
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
std::vector<std::string> sceneNames = {
|
||||
"Inside the Deku Tree",
|
||||
@@ -318,3 +319,20 @@ void SohUtils::CopyStringToCharArray(char* destination, std::string source, size
|
||||
strncpy(destination, source.c_str(), size - 1);
|
||||
destination[size - 1] = '\0';
|
||||
}
|
||||
|
||||
std::string SohUtils::Sanitize(std::string stringValue) {
|
||||
// Add backslashes.
|
||||
for (auto i = stringValue.begin();;) {
|
||||
auto const pos = std::find_if(i, stringValue.end(), [](char const c) { return '\\' == c || '\'' == c || '"' == c; });
|
||||
if (pos == stringValue.end()) {
|
||||
break;
|
||||
}
|
||||
i = std::next(stringValue.insert(pos, '\\'), 2);
|
||||
}
|
||||
|
||||
// Removes others.
|
||||
stringValue.erase(std::remove_if(stringValue.begin(), stringValue.end(), [](char const c) {
|
||||
return '\n' == c || '\r' == c || '\0' == c || '\x1A' == c; }), stringValue.end());
|
||||
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user