mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-12-06 18:18:23 +00:00
Revert tier1 changes (#350)
This commit is contained in:
parent
19e59dc14c
commit
7c7411cc10
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -39,7 +39,6 @@ class CUtlBuffer;
|
||||
class Color;
|
||||
typedef void * FileHandle_t;
|
||||
class CKeyValuesGrowableStringTable;
|
||||
class IKeyValuesSystem;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Simple recursive data access class
|
||||
@ -118,12 +117,9 @@ public:
|
||||
// gets the name as a unique int
|
||||
int GetNameSymbol() const { return m_iKeyName; }
|
||||
|
||||
bool IsUsingLocalStorage() const;
|
||||
|
||||
// File access. Set UsesEscapeSequences true, if resource file/buffer uses Escape Sequences (eg \n, \t)
|
||||
void UsesEscapeSequences(bool state); // default false
|
||||
void UsesConditionals(bool state); // default true
|
||||
|
||||
bool LoadFromFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL, bool refreshCache = false );
|
||||
bool SaveToFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL, bool sortKeys = false, bool bAllowEmptyString = false, bool bCacheResult = false );
|
||||
|
||||
@ -334,14 +330,12 @@ private:
|
||||
char m_iDataType;
|
||||
char m_bHasEscapeSequences; // true, if while parsing this KeyValue, Escape Sequences are used (default false)
|
||||
char m_bEvaluateConditionals; // true, if while parsing this KeyValue, conditionals blocks are evaluated (default true)
|
||||
char m_bLocalStorage;
|
||||
char unused[1];
|
||||
|
||||
KeyValues *m_pPeer; // pointer to next key in list
|
||||
KeyValues *m_pSub; // pointer to Start of a new sub key list
|
||||
KeyValues *m_pChain;// Search here if it's not in our list
|
||||
|
||||
CKeyValuesGrowableStringTable* m_pStringTable;
|
||||
|
||||
private:
|
||||
// Statics to implement the optional growable string table
|
||||
// Function pointers that will determine which mode we are in
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "tier0/vprof_telemetry.h"
|
||||
#include <Color.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include "tier0/dbg.h"
|
||||
#include "tier0/mem.h"
|
||||
#include "utlbuffer.h"
|
||||
@ -462,9 +461,9 @@ void KeyValues::Init()
|
||||
|
||||
m_bHasEscapeSequences = false;
|
||||
m_bEvaluateConditionals = true;
|
||||
m_bLocalStorage = false;
|
||||
|
||||
m_pStringTable = NULL;
|
||||
// for future proof
|
||||
memset( unused, 0, sizeof(unused) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -529,10 +528,7 @@ void KeyValues::ChainKeyValue( KeyValues* pChain )
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *KeyValues::GetName( void ) const
|
||||
{
|
||||
if ( m_bLocalStorage )
|
||||
return m_pStringTable->GetStringForSymbol( m_iKeyName );
|
||||
else
|
||||
return s_pfGetStringForSymbol( m_iKeyName );
|
||||
return s_pfGetStringForSymbol( m_iKeyName );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1005,9 +1001,7 @@ KeyValues *KeyValues::FindKey(const char *keyName, bool bCreate)
|
||||
}
|
||||
|
||||
// lookup the symbol for the search string
|
||||
HKeySymbol iSearchStr = m_bLocalStorage
|
||||
? m_pStringTable->GetSymbolForString( searchStr, bCreate )
|
||||
: s_pfGetSymbolForString( searchStr, bCreate );
|
||||
HKeySymbol iSearchStr = s_pfGetSymbolForString( searchStr, bCreate );
|
||||
|
||||
if ( iSearchStr == INVALID_KEY_SYMBOL )
|
||||
{
|
||||
@ -1386,8 +1380,15 @@ float KeyValues::GetFloat( const char *keyName, float defaultValue )
|
||||
switch ( dat->m_iDataType )
|
||||
{
|
||||
case TYPE_STRING:
|
||||
return std::strtof(dat->m_sValue, nullptr);
|
||||
case TYPE_FLOAT:
|
||||
return (float)atof(dat->m_sValue);
|
||||
case TYPE_WSTRING:
|
||||
#ifdef WIN32
|
||||
return (float) _wtof(dat->m_wsValue); // no wtof
|
||||
#else
|
||||
Assert( !"impl me" );
|
||||
return 0.0;
|
||||
#endif
|
||||
case TYPE_FLOAT:
|
||||
return dat->m_flValue;
|
||||
case TYPE_INT:
|
||||
return (float)dat->m_iValue;
|
||||
@ -1729,18 +1730,7 @@ void KeyValues::SetFloat( const char *keyName, float value )
|
||||
|
||||
void KeyValues::SetName( const char * setName )
|
||||
{
|
||||
if ( m_bLocalStorage )
|
||||
m_iKeyName = m_pStringTable->GetSymbolForString( setName );
|
||||
else
|
||||
m_iKeyName = s_pfGetSymbolForString( setName, true );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
bool KeyValues::IsUsingLocalStorage() const
|
||||
{
|
||||
return m_bLocalStorage != 0;
|
||||
m_iKeyName = s_pfGetSymbolForString( setName, true );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user