- removed unused CVAR_GUID type

This commit is contained in:
Christoph Oelckers 2019-06-27 09:16:34 +02:00
parent 3810d9beb3
commit 5ef43143f8
6 changed files with 7 additions and 230 deletions

View file

@ -293,9 +293,6 @@ bool FBaseCVar::ToBool (UCVarValue value, ECVarType type)
else
return !!strtoll (value.String, NULL, 0);
case CVAR_GUID:
return false;
default:
return false;
}
@ -327,7 +324,6 @@ int FBaseCVar::ToInt (UCVarValue value, ECVarType type)
res = (int)strtoll (value.String, NULL, 0);
break;
}
case CVAR_GUID: res = 0; break;
default: res = 0; break;
}
return res;
@ -349,9 +345,6 @@ float FBaseCVar::ToFloat (UCVarValue value, ECVarType type)
case CVAR_String:
return (float)strtod (value.String, NULL);
case CVAR_GUID:
return 0.f;
default:
return 0.f;
}
@ -382,10 +375,6 @@ const char *FBaseCVar::ToString (UCVarValue value, ECVarType type)
IGNORE_FORMAT_POST
break;
case CVAR_GUID:
FormatGUID (cstrbuf, countof(cstrbuf), *value.pGUID);
break;
default:
strcpy (cstrbuf, "<huh?>");
break;
@ -393,24 +382,6 @@ const char *FBaseCVar::ToString (UCVarValue value, ECVarType type)
return cstrbuf;
}
const GUID *FBaseCVar::ToGUID (UCVarValue value, ECVarType type)
{
UCVarValue trans;
switch (type)
{
case CVAR_String:
trans = FromString (value.String, CVAR_GUID);
return trans.pGUID;
case CVAR_GUID:
return value.pGUID;
default:
return NULL;
}
}
UCVarValue FBaseCVar::FromBool (bool value, ECVarType type)
{
UCVarValue ret;
@ -433,10 +404,6 @@ UCVarValue FBaseCVar::FromBool (bool value, ECVarType type)
ret.String = value ? truestr : falsestr;
break;
case CVAR_GUID:
ret.pGUID = NULL;
break;
default:
break;
}
@ -467,10 +434,6 @@ UCVarValue FBaseCVar::FromInt (int value, ECVarType type)
ret.String = cstrbuf;
break;
case CVAR_GUID:
ret.pGUID = NULL;
break;
default:
break;
}
@ -503,10 +466,6 @@ UCVarValue FBaseCVar::FromFloat (float value, ECVarType type)
ret.String = cstrbuf;
break;
case CVAR_GUID:
ret.pGUID = NULL;
break;
default:
break;
}
@ -569,57 +528,6 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
ret.String = const_cast<char *>(value);
break;
case CVAR_GUID:
// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
// 01234567890123456789012345678901234567
// 0 1 2 3
ret.pGUID = NULL;
if (value == NULL)
{
break;
}
for (i = 0; value[i] != 0 && i < 38; i++)
{
switch (i)
{
case 0:
if (value[i] != '{')
break;
case 9:
case 14:
case 19:
case 24:
if (value[i] != '-')
break;
case 37:
if (value[i] != '}')
break;
default:
if (value[i] < '0' ||
(value[i] > '9' && value[i] < 'A') ||
(value[i] > 'F' && value[i] < 'a') ||
value[i] > 'f')
break;
}
}
if (i == 38 && value[i] == 0)
{
cGUID.Data1 = strtoul (value + 1, NULL, 16);
cGUID.Data2 = (uint16_t)strtoul (value + 10, NULL, 16);
cGUID.Data3 = (uint16_t)strtoul (value + 15, NULL, 16);
cGUID.Data4[0] = HexToByte (value + 20);
cGUID.Data4[1] = HexToByte (value + 22);
cGUID.Data4[2] = HexToByte (value + 25);
cGUID.Data4[3] = HexToByte (value + 27);
cGUID.Data4[4] = HexToByte (value + 29);
cGUID.Data4[5] = HexToByte (value + 31);
cGUID.Data4[6] = HexToByte (value + 33);
cGUID.Data4[7] = HexToByte (value + 35);
ret.pGUID = &cGUID;
}
break;
default:
break;
}
@ -627,39 +535,6 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
return ret;
}
UCVarValue FBaseCVar::FromGUID (const GUID &guid, ECVarType type)
{
UCVarValue ret;
switch (type)
{
case CVAR_Bool:
ret.Bool = false;
break;
case CVAR_Int:
ret.Int = 0;
break;
case CVAR_Float:
ret.Float = 0.f;
break;
case CVAR_String:
ret.pGUID = &guid;
ret.String = ToString (ret, CVAR_GUID);
break;
case CVAR_GUID:
ret.pGUID = &guid;
break;
default:
break;
}
return ret;
}
FBaseCVar *cvar_set (const char *var_name, const char *val)
{
FBaseCVar *var;
@ -1053,80 +928,6 @@ int FColorCVar::ToInt2 (UCVarValue value, ECVarType type)
return ret;
}
//
// GUID cvar implementation
//
FGUIDCVar::FGUIDCVar (const char *name, const GUID *def, uint32_t flags, void (*callback)(FGUIDCVar &))
: FBaseCVar (name, flags, reinterpret_cast<void (*)(FBaseCVar &)>(callback))
{
if (def != NULL)
{
DefaultValue = *def;
if (Flags & CVAR_ISDEFAULT)
Value = *def;
}
else
{
memset (&Value, 0, sizeof(DefaultValue));
memset (&DefaultValue, 0, sizeof(DefaultValue));
}
}
ECVarType FGUIDCVar::GetRealType () const
{
return CVAR_GUID;
}
UCVarValue FGUIDCVar::GetGenericRep (ECVarType type) const
{
return FromGUID (Value, type);
}
UCVarValue FGUIDCVar::GetFavoriteRep (ECVarType *type) const
{
UCVarValue ret;
*type = CVAR_GUID;
ret.pGUID = &Value;
return ret;
}
UCVarValue FGUIDCVar::GetGenericRepDefault (ECVarType type) const
{
return FromGUID (DefaultValue, type);
}
UCVarValue FGUIDCVar::GetFavoriteRepDefault (ECVarType *type) const
{
UCVarValue ret;
*type = CVAR_GUID;
ret.pGUID = &DefaultValue;
return ret;
}
void FGUIDCVar::SetGenericRepDefault (UCVarValue value, ECVarType type)
{
const GUID *guid = ToGUID (value, type);
if (guid != NULL)
{
Value = *guid;
if (Flags & CVAR_ISDEFAULT)
{
SetGenericRep (value, type);
Flags |= CVAR_ISDEFAULT;
}
}
}
void FGUIDCVar::DoSet (UCVarValue value, ECVarType type)
{
const GUID *guid = ToGUID (value, type);
if (guid != NULL)
{
Value = *guid;
}
}
//
// More base cvar stuff
//

View file

@ -34,7 +34,7 @@
#ifndef __C_CVARS_H__
#define __C_CVARS_H__
#include "doomtype.h"
#include "zstring.h"
#include "tarray.h"
/*
@ -73,7 +73,6 @@ union UCVarValue
int Int;
float Float;
const char *String;
const GUID *pGUID;
};
enum ECVarType
@ -85,8 +84,7 @@ enum ECVarType
CVAR_Color, // stored as CVAR_Int
CVAR_DummyBool, // just redirects to another cvar
CVAR_DummyInt, // just redirects to another cvar
CVAR_Dummy, // Unknown
CVAR_GUID
CVAR_Dummy // Unknown
};
class FConfigFile;
@ -140,12 +138,10 @@ protected:
static int ToInt (UCVarValue value, ECVarType type);
static float ToFloat (UCVarValue value, ECVarType type);
static const char *ToString (UCVarValue value, ECVarType type);
static const GUID *ToGUID (UCVarValue value, ECVarType type);
static UCVarValue FromBool (bool value, ECVarType type);
static UCVarValue FromInt (int value, ECVarType type);
static UCVarValue FromFloat (float value, ECVarType type);
static UCVarValue FromString (const char *value, ECVarType type);
static UCVarValue FromGUID (const GUID &value, ECVarType type);
char *Name;
FString SafeValue;
@ -403,31 +399,6 @@ protected:
int BitNum;
};
class FGUIDCVar : public FBaseCVar
{
public:
FGUIDCVar (const char *name, const GUID *defguid, uint32_t flags, void (*callback)(FGUIDCVar &)=NULL);
virtual ECVarType GetRealType () const;
virtual UCVarValue GetGenericRep (ECVarType type) const;
virtual UCVarValue GetFavoriteRep (ECVarType *type) const;
virtual UCVarValue GetGenericRepDefault (ECVarType type) const;
virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const;
virtual void SetGenericRepDefault (UCVarValue value, ECVarType type);
const GUID &operator= (const GUID &guidval)
{ UCVarValue val; val.pGUID = &guidval; SetGenericRep (val, CVAR_GUID); return guidval; }
inline operator const GUID & () const { return Value; }
inline const GUID &operator *() const { return Value; }
protected:
virtual void DoSet (UCVarValue value, ECVarType type);
GUID Value;
GUID DefaultValue;
};
extern int cvar_defflags;
FBaseCVar *cvar_set (const char *var_name, const char *value);

View file

@ -36,6 +36,7 @@
#import <Foundation/NSRunLoop.h>
#include "c_cvars.h"
#include "doomtype.h"
#include "st_console.h"
#include "st_start.h"

View file

@ -1,6 +1,8 @@
#ifndef __RES_CMAP_H
#define __RES_CMAP_H
#include "doomtype.h"
struct lightlist_t;
void R_InitColormaps ();

View file

@ -29,6 +29,7 @@
#include "gl_load/gl_system.h"
#include "templates.h"
#include "c_cvars.h"
#include "doomtype.h"
#include "r_data/colormaps.h"
#include "hwrenderer/textures/hw_material.h"

View file

@ -39,6 +39,7 @@
#include "doomdef.h"
#include "c_cvars.h"
#include "doomstat.h"
#include "doomtype.h"
//==========================================================================
//