Esempio n. 1
0
File: hud.cpp Progetto: Yosam02/game
 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);
 }
Esempio n. 2
0
	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");
	}
Esempio n. 3
0
const char *KeyValues::GetName(void) const
{
	return KeyValuesSystem()->GetStringForSymbol(m_iKeyName);
}
Esempio n. 4
0
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;
}
Esempio n. 5
0
void KeyValues::operator delete(void *pMem)
{
	KeyValuesSystem()->FreeKeyValuesMemory(pMem);
}
Esempio n. 6
0
void *KeyValues::operator new(unsigned int iAllocSize, int nBlockUse, const char *pFileName, int nLine)
{
	return KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);
}
Esempio n. 7
0
void *KeyValues::operator new(unsigned int iAllocSize)
{
	return KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);
}
Esempio n. 8
0
void KeyValues::SetName(const char *setName)
{
	m_iKeyName = KeyValuesSystem()->GetSymbolForString(setName);
}
Esempio n. 9
0
//The server can just use KeyValuesSystem() directly. - Solokiller
IKeyValuesSystem *keyvalues()
{
	return KeyValuesSystem();
}