forked from FWGS/mainui_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CFGScript.h
82 lines (66 loc) · 1.71 KB
/
CFGScript.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
cfgscript.c - "Valve script" parsing routines
Copyright (C) 2016 mittorn
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef CFGSCRIPT_H
#define CFGSCRIPT_H
#define MAX_STRING 256
#include "StringArrayModel.h"
typedef enum
{
T_NONE = 0,
T_BOOL,
T_NUMBER,
T_LIST,
T_STRING,
T_COUNT
} cvartype_t;
struct scrvarlistentry_t
{
scrvarlistentry_t() : szName( NULL ), flValue( 0 ), next( NULL ) {}
char *szName;
float flValue;
scrvarlistentry_t *next;
};
struct scrvarlist_t
{
scrvarlist_t() : iCount( 0 ), pEntries( NULL ), pLast( NULL ), pArray( NULL ), pModel( NULL ) {}
int iCount;
scrvarlistentry_t *pEntries;
scrvarlistentry_t *pLast;
const char **pArray;
CStringArrayModel *pModel; // ready model for use in UI
};
struct scrvarnumber_t
{
scrvarnumber_t() : fMin( 0 ), fMax( 0 ) {}
float fMin;
float fMax;
};
struct scrvardef_t
{
scrvardef_t() : flags( 0 ), number(), list(), type( T_NONE ), next( NULL )
{
name[0] = value[0] = desc[0] = 0;
}
int flags;
char name[MAX_STRING];
char value[MAX_STRING];
char desc[MAX_STRING];
scrvarnumber_t number;
scrvarlist_t list;
cvartype_t type;
struct scrvardef_t *next;
};
scrvardef_t *CSCR_LoadDefaultCVars( const char *scriptfilename, int *count );
void CSCR_FreeList( scrvardef_t *list );
#endif // CFGSCRIPT_H