Skip to content

Commit

Permalink
Make RemoveOption Case-Insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Deaod committed Apr 6, 2024
1 parent df89500 commit 16d226a
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions Classes/NewCTF.uc
Original file line number Diff line number Diff line change
Expand Up @@ -436,22 +436,34 @@ event PlayerPawn Login(
return Result;
}
function string RemoveOption(string Options, string ToRemove) {
function string RemoveOptionSingle(string Option, string ToRemove) {
local int Pos;
local string Result;
Pos = InStr(Options, "?"$ToRemove$"=");
Pos = InStr(Option, "=");
if ((Pos >= 0 && Left(Option, Pos) ~= ToRemove) || (Pos < 0 && Option ~= ToRemove)) {
return "";
} else {
return "?" $ Option;
}
}
if (Pos < 0)
return Options; // nothing to remove;
function string RemoveOption(string Options, string ToRemove) {
local int Pos;
local string Result, Option;
if (Left(Options, 1) == "?")
Options = Mid(Options, 1);
Result = Left(Options, Pos);
Options = Mid(Options, Pos + Len(ToRemove) + 2);
Pos = InStr(Options, "?");
if (Pos < 0)
return Result;
return RemoveOption(Result $ Mid(Options, Pos), ToRemove); // recurse to find all occurrences
while(Pos >= 0) {
Result = Result $ RemoveOptionSingle(Left(Options, Pos), ToRemove);
Options = Mid(Options, Pos + 1);
Pos = InStr(Options, "?");
}
return Result $ RemoveOptionSingle(Options, ToRemove);
}
function Mutator FindWarmupMutator() {
Expand Down

0 comments on commit 16d226a

Please sign in to comment.