mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-07 08:21:59 +00:00
CVARINFO: added support for "cheat" and "latch" flags. Fixes #535
This commit is contained in:
parent
9de8202aa4
commit
0264224e6e
1 changed files with 18 additions and 8 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using CodeImp.DoomBuilder.Config;
|
using CodeImp.DoomBuilder.Config;
|
||||||
using CodeImp.DoomBuilder.Data;
|
using CodeImp.DoomBuilder.Data;
|
||||||
using CodeImp.DoomBuilder.Rendering;
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
|
@ -51,26 +52,35 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
|
|
||||||
// Continue until at the end of the stream
|
// Continue until at the end of the stream
|
||||||
HashSet<string> knowntypes = new HashSet<string> { "int", "float", "color", "bool", "string" };
|
HashSet<string> knowntypes = new HashSet<string> { "int", "float", "color", "bool", "string" };
|
||||||
|
HashSet<string> flags = new HashSet<string> { "noarchive", "cheat", "latch" };
|
||||||
while(SkipWhitespace(true))
|
while(SkipWhitespace(true))
|
||||||
{
|
{
|
||||||
string token = ReadToken().ToLowerInvariant();
|
string token = ReadToken().ToLowerInvariant();
|
||||||
if(string.IsNullOrEmpty(token)) continue;
|
if(string.IsNullOrEmpty(token)) continue;
|
||||||
|
|
||||||
//<scope> [noarchive] <type> <name> [= <defaultvalue>];
|
//<scope> [noarchive] [cheat] [latch] <type> <name> [= <defaultvalue>];
|
||||||
switch(token)
|
switch(token)
|
||||||
{
|
{
|
||||||
case "user": case "server":
|
case "user": case "server":
|
||||||
|
// read (skip) flags
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
string flagtoken;
|
||||||
|
|
||||||
|
SkipWhitespace(true);
|
||||||
|
flagtoken = ReadToken().ToLowerInvariant();
|
||||||
|
|
||||||
|
if(!flags.Contains(flagtoken))
|
||||||
|
{
|
||||||
|
DataStream.Seek(-flagtoken.Length - 1, SeekOrigin.Current);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
SkipWhitespace(true);
|
SkipWhitespace(true);
|
||||||
string type = ReadToken().ToLowerInvariant();
|
string type = ReadToken().ToLowerInvariant();
|
||||||
|
|
||||||
// Can be "noarchive" keyword
|
|
||||||
if(type == "noarchive")
|
|
||||||
{
|
|
||||||
SkipWhitespace(true);
|
|
||||||
type = ReadToken().ToLowerInvariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!knowntypes.Contains(type))
|
if(!knowntypes.Contains(type))
|
||||||
{
|
{
|
||||||
ReportError("Unknown cvar type");
|
ReportError("Unknown cvar type");
|
||||||
|
|
Loading…
Reference in a new issue