PoolString Application::AddPooledLiteral(const ConstString &string) { PoolString result = FindPooledString(string); if(result) return result; ork::Application* papp = ApplicationStack::Top(); OrkAssert(papp); return papp->GetStringPool().Literal(string); }
PoolString Application::AddPooledString(const PieceString &string) { PoolString result = FindPooledString(string); if(result) return result; ResizableString copy(string); const char *data = copy.c_str(); new(©) ResizableString; ork::Application* papp = ApplicationStack::Top(); OrkAssert(papp); return papp->GetStringPool().String(data); }
//----------------------------------------------------------------------------- // Purpose: Tests the enemy's name or classname // Input : *pEnemy - Entity being assessed // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CFilterEnemy::PassesNameFilter( CBaseEntity *pEnemy ) { // If there is no name specified, we're not using it if ( m_iszEnemyName == NULL_STRING ) return true; // Cache off the special case player name if ( m_iszPlayerName == NULL_STRING ) { m_iszPlayerName = FindPooledString( "!player" ); } if ( m_iszEnemyName == m_iszPlayerName ) { if ( pEnemy->IsPlayer() ) { if ( m_bNegated ) return false; return true; } } // May be either a targetname or classname bool bNameOrClassnameMatches = ( m_iszEnemyName == pEnemy->GetEntityName() || m_iszEnemyName == pEnemy->m_iClassname ); // We only leave this code block in a state meaning we've "succeeded" in any context if ( m_bNegated ) { // We wanted the names to not match, but they did if ( bNameOrClassnameMatches ) return false; } else { // We wanted them to be the same, but they weren't if ( bNameOrClassnameMatches == false ) return false; } return true; }
Class *Class::FindClass(const ConstString &name) { return OrkSTXFindValFromKey(mClassMap, FindPooledString(name.c_str()), NULL); }