DEADSOFTWARE

Game: Use proper syntax of sets for game options instead of raw bitwise operations
[d2df-sdl.git] / src / shared / envvars.pas
index 5c60fd0d7c1adefe3508ebaf7f5d3cc948512820..a15feef0e1dc37e4cddde1038c004a390d33a92b 100644 (file)
@@ -2,8 +2,7 @@
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -64,14 +63,8 @@ end;
     {$ELSE}
       Result := '';
     {$ENDIF}
-    (* invalidate username with non-cp1251 symbols *)
-    i := Low(Result);
-    while i <= High(Result) do
-    begin
-      if Result[i] = '?' then
-        Result := '';
-      Inc(i)
-    end
+    // Remove non 1251 chars
+    Result := StringReplace(Result, Invalid1251Char, '', [rfReplaceAll]);
   end;
 
 end.