diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-09-05 17:47:11 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-09-05 17:47:11 +1000 |
commit | 7c68b8f4af38cef84e598756c0b18f0ffba60a8f (patch) | |
tree | 6f7f086df394feb57e90c6421d36b55923a4bb63 /source/game/StarNameGenerator.cpp | |
parent | fd915ce6725ce80150d9098d65f2c0909c111770 (diff) |
Make the profanity filter not as insanely strict as Warframe's
The profanity filter sucks. Male glitch have a possibility of generating with "Brass" at the start that is never allowed because "ASS"!! and human names Cassie and Cassidy also never pass because of this.
Diffstat (limited to 'source/game/StarNameGenerator.cpp')
-rw-r--r-- | source/game/StarNameGenerator.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/game/StarNameGenerator.cpp b/source/game/StarNameGenerator.cpp index 6dd2350..6b8223e 100644 --- a/source/game/StarNameGenerator.cpp +++ b/source/game/StarNameGenerator.cpp @@ -113,10 +113,13 @@ String PatternedNameGenerator::processRule(JsonArray const& rule, RandomSource& } bool PatternedNameGenerator::isProfane(String const& name) const { - auto matchName = name.toLower().rot13(); - for (auto naughtyWord : m_profanityFilter) { - if (matchName.contains(naughtyWord)) - return true; + auto matchNames = name.toLower().rot13().splitAny(" -"); + for (auto& naughtyWord : m_profanityFilter) { + for (auto& matchName : matchNames) { + auto find = matchName.find(naughtyWord); + if (find != NPos && (find == 0 || naughtyWord.size() + 1 >= matchName.size())) + return true; + } } return false; } |