MCPcopy Create free account
hub / github.com/BSVino/DoubleAction / ParseEnumeration

Method ParseEnumeration

mp/src/game/server/AI_ResponseSystem.cpp:2436–2485  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Purpose: Input : *kv - -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2434// Input : *kv -
2435//-----------------------------------------------------------------------------
2436void CResponseSystem::ParseEnumeration( void )
2437{
2438 char enumerationName[ 128 ];
2439 ParseToken();
2440 Q_strncpy( enumerationName, token, sizeof( enumerationName ) );
2441
2442 ParseToken();
2443 if ( Q_stricmp( token, "{" ) )
2444 {
2445 ResponseWarning( "Expecting '{' in enumeration '%s', got '%s'\n", enumerationName, token );
2446 return;
2447 }
2448
2449 while ( 1 )
2450 {
2451 ParseToken();
2452 if ( !Q_stricmp( token, "}" ) )
2453 break;
2454
2455 if ( Q_strlen( token ) <= 0 )
2456 {
2457 ResponseWarning( "Expecting more tokens in enumeration '%s'\n", enumerationName );
2458 break;
2459 }
2460
2461 char key[ 128 ];
2462
2463 Q_strncpy( key, token, sizeof( key ) );
2464 ParseToken();
2465 float value = (float)atof( token );
2466
2467 char sz[ 128 ];
2468 Q_snprintf( sz, sizeof( sz ), "[%s::%s]", enumerationName, key );
2469 Q_strlower( sz );
2470
2471 Enumeration newEnum;
2472 newEnum.value = value;
2473
2474 if ( m_Enumerations.Find( sz ) == m_Enumerations.InvalidIndex() )
2475 {
2476 m_Enumerations.Insert( sz, newEnum );
2477 }
2478 /*
2479 else
2480 {
2481 ResponseWarning( "Ignoring duplication enumeration '%s'\n", sz );
2482 }
2483 */
2484 }
2485}
2486
2487//-----------------------------------------------------------------------------
2488// Purpose:

Callers

nothing calls this directly

Calls 4

ParseTokenFunction · 0.70
FindMethod · 0.45
InvalidIndexMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected