----------------------------------------------------------------------------- Purpose: Input : *kv - -----------------------------------------------------------------------------
| 2489 | // Input : *kv - |
| 2490 | //----------------------------------------------------------------------------- |
| 2491 | void CResponseSystem::ParseRule( void ) |
| 2492 | { |
| 2493 | static int instancedCriteria = 0; |
| 2494 | |
| 2495 | char ruleName[ 128 ]; |
| 2496 | ParseToken(); |
| 2497 | Q_strncpy( ruleName, token, sizeof( ruleName ) ); |
| 2498 | |
| 2499 | ParseToken(); |
| 2500 | if ( Q_stricmp( token, "{" ) ) |
| 2501 | { |
| 2502 | ResponseWarning( "Expecting '{' in rule '%s', got '%s'\n", ruleName, token ); |
| 2503 | return; |
| 2504 | } |
| 2505 | |
| 2506 | // entries are "criteria", "response" or an in-line criteria to instance |
| 2507 | Rule newRule; |
| 2508 | |
| 2509 | char sz[ 128 ]; |
| 2510 | |
| 2511 | bool validRule = true; |
| 2512 | while ( 1 ) |
| 2513 | { |
| 2514 | ParseToken(); |
| 2515 | if ( !Q_stricmp( token, "}" ) ) |
| 2516 | { |
| 2517 | break; |
| 2518 | } |
| 2519 | |
| 2520 | if ( Q_strlen( token ) <= 0 ) |
| 2521 | { |
| 2522 | ResponseWarning( "Expecting more tokens in rule '%s'\n", ruleName ); |
| 2523 | break; |
| 2524 | } |
| 2525 | |
| 2526 | if ( !Q_stricmp( token, "matchonce" ) ) |
| 2527 | { |
| 2528 | newRule.m_bMatchOnce = true; |
| 2529 | continue; |
| 2530 | } |
| 2531 | |
| 2532 | if ( !Q_stricmp( token, "applyContextToWorld" ) ) |
| 2533 | { |
| 2534 | newRule.m_bApplyContextToWorld = true; |
| 2535 | continue; |
| 2536 | } |
| 2537 | |
| 2538 | if ( !Q_stricmp( token, "applyContext" ) ) |
| 2539 | { |
| 2540 | ParseToken(); |
| 2541 | if ( newRule.GetContext() == NULL ) |
| 2542 | { |
| 2543 | newRule.SetContext( token ); |
| 2544 | } |
| 2545 | else |
| 2546 | { |
| 2547 | CFmtStrN<1024> newContext( "%s,%s", newRule.GetContext(), token ); |
| 2548 | newRule.SetContext( newContext ); |
nothing calls this directly
no test coverage detected