core/logic/GameConfigs.cpp
changeset 4114 58146f5766f0
parent 4063 7b7372572e85
child 4236 843313c70517
     1.1 --- a/core/logic/GameConfigs.cpp	Sat Aug 31 19:50:15 2013 -0700
     1.2 +++ b/core/logic/GameConfigs.cpp	Sat Aug 31 19:50:26 2013 -0700
     1.3 @@ -119,7 +119,6 @@
     1.4  CGameConfig::CGameConfig(const char *file, const char *engine)
     1.5  {
     1.6  	strncopy(m_File, file, sizeof(m_File));
     1.7 -	m_pStrings = new BaseStringTable(512);
     1.8  
     1.9  	m_CustomLevel = 0;
    1.10  	m_CustomHandler = NULL;
    1.11 @@ -352,7 +351,8 @@
    1.12  			m_Offsets.replace(m_offset, atoi(value));
    1.13  		}
    1.14  	} else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
    1.15 -		m_Keys.replace(key, m_pStrings->AddString(value));
    1.16 +		ke::AString vstr(value);
    1.17 +		m_Keys.replace(key, ke::Move(vstr));
    1.18  	} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
    1.19  		if (strcmp(key, "game") == 0)
    1.20  		{
    1.21 @@ -757,7 +757,6 @@
    1.22  bool CGameConfig::Reparse(char *error, size_t maxlength)
    1.23  {
    1.24  	/* Reset cached data */
    1.25 -	m_pStrings->Reset();
    1.26  	m_Offsets.clear();
    1.27  	m_Props.clear();
    1.28  	m_Keys.clear();
    1.29 @@ -921,10 +920,10 @@
    1.30  
    1.31  const char *CGameConfig::GetKeyValue(const char *key)
    1.32  {
    1.33 -	int address;
    1.34 -	if (!m_Keys.retrieve(key, &address))
    1.35 +	StringHashMap<ke::AString>::Result r = m_Keys.find(key);
    1.36 +	if (!r.found())
    1.37  		return NULL;
    1.38 -	return m_pStrings->GetString(address);
    1.39 +	return r->value.chars();
    1.40  }
    1.41  
    1.42  //memory addresses below 0x10000 are automatically considered invalid for dereferencing