HudTextureFileRef(const char *cszFileKey, const char *cszHudTexturePrefix) { Q_strncpy(m_cszFileKey, cszFileKey, kcszFileKeyLength); Q_strncpy(m_cszHudTexturePrefix, cszHudTexturePrefix, kcszHudTexturePrefix); m_uiPrefixLength = Q_strlen(cszHudTexturePrefix); m_fileKeySymbol = KeyValuesSystem()->GetSymbolForString(m_cszFileKey); Assert(m_fileKeySymbol != INVALID_KEY_SYMBOL); }
void ReportError(const char *pError) { Warning("KeyValues Error: %s in file %s\n", pError, m_pFilename); for (int i = 0; i < m_maxErrorIndex; i++) { if (m_errorStack[i] != INVALID_KEY_SYMBOL) { if (i < m_errorIndex) { Warning("%s, ", KeyValuesSystem()->GetStringForSymbol(m_errorStack[i])); } else { Warning("(*%s*), ", KeyValuesSystem()->GetStringForSymbol(m_errorStack[i])); } } } Warning("\n"); }
const char *KeyValues::GetName(void) const { return KeyValuesSystem()->GetStringForSymbol(m_iKeyName); }
KeyValues *KeyValues::FindKey(const char *keyName, bool bCreate) { if (!keyName || !keyName[0]) return this; char szBuf[256]; const char *subStr = strchr(keyName, '/'); const char *searchStr = keyName; if (subStr) { int size = subStr - keyName; Q_memcpy(szBuf, keyName, size); szBuf[size] = 0; searchStr = szBuf; } HKeySymbol iSearchStr = KeyValuesSystem()->GetSymbolForString(searchStr); if (iSearchStr == INVALID_KEY_SYMBOL) { return NULL; } KeyValues *lastItem = NULL; KeyValues *dat; for (dat = m_pSub; dat != NULL; dat = dat->m_pPeer) { lastItem = dat; if (dat->m_iKeyName == iSearchStr) { break; } } if (!dat && m_pChain) { dat = m_pChain->FindKey(keyName, false); } if (!dat) { if (bCreate) { dat = new KeyValues(searchStr); if (lastItem) { lastItem->m_pPeer = dat; } else { m_pSub = dat; } dat->m_pPeer = NULL; m_iDataType = TYPE_NONE; } else { return NULL; } } if (subStr) { return dat->FindKey(subStr + 1, bCreate); } return dat; }
void KeyValues::operator delete(void *pMem) { KeyValuesSystem()->FreeKeyValuesMemory(pMem); }
void *KeyValues::operator new(unsigned int iAllocSize, int nBlockUse, const char *pFileName, int nLine) { return KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize); }
void *KeyValues::operator new(unsigned int iAllocSize) { return KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize); }
void KeyValues::SetName(const char *setName) { m_iKeyName = KeyValuesSystem()->GetSymbolForString(setName); }
//The server can just use KeyValuesSystem() directly. - Solokiller IKeyValuesSystem *keyvalues() { return KeyValuesSystem(); }