Skip to content
Snippets Groups Projects
Commit 0264224e authored by biwa's avatar biwa
Browse files

CVARINFO: added support for "cheat" and "latch" flags. Fixes #535

parent 9de8202a
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Rendering;
......@@ -51,26 +52,35 @@ namespace CodeImp.DoomBuilder.ZDoom
// Continue until at the end of the stream
HashSet<string> knowntypes = new HashSet<string> { "int", "float", "color", "bool", "string" };
HashSet<string> flags = new HashSet<string> { "noarchive", "cheat", "latch" };
while(SkipWhitespace(true))
{
string token = ReadToken().ToLowerInvariant();
if(string.IsNullOrEmpty(token)) continue;
//<scope> [noarchive] <type> <name> [= <defaultvalue>];
//<scope> [noarchive] [cheat] [latch] <type> <name> [= <defaultvalue>];
switch(token)
{
case "user": case "server":
// Type
SkipWhitespace(true);
string type = ReadToken().ToLowerInvariant();
// Can be "noarchive" keyword
if(type == "noarchive")
// read (skip) flags
while(true)
{
string flagtoken;
SkipWhitespace(true);
type = ReadToken().ToLowerInvariant();
flagtoken = ReadToken().ToLowerInvariant();
if(!flags.Contains(flagtoken))
{
DataStream.Seek(-flagtoken.Length - 1, SeekOrigin.Current);
break;
}
}
// Type
SkipWhitespace(true);
string type = ReadToken().ToLowerInvariant();
if(!knowntypes.Contains(type))
{
ReportError("Unknown cvar type");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment