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

Method ParseOneResponse

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

Source from the content-addressed store, hash-verified

2033}
2034
2035void CResponseSystem::ParseOneResponse( const char *responseGroupName, ResponseGroup& group )
2036{
2037 Response newResponse;
2038 newResponse.weight.SetFloat( 1.0f );
2039 AI_ResponseParams *rp = &group.rp;
2040
2041 newResponse.type = ComputeResponseType( token );
2042 if ( RESPONSE_NONE == newResponse.type )
2043 {
2044 ResponseWarning( "response entry '%s' with unknown response type '%s'\n", responseGroupName, token );
2045 return;
2046 }
2047
2048 ParseToken();
2049 newResponse.value = CopyString( token );
2050
2051 while ( TokenWaiting() )
2052 {
2053 ParseToken();
2054 if ( !Q_stricmp( token, "weight" ) )
2055 {
2056 ParseToken();
2057 newResponse.weight.SetFloat( (float)atof( token ) );
2058 continue;
2059 }
2060
2061 if ( !Q_stricmp( token, "predelay" ) )
2062 {
2063 ParseToken();
2064 rp->flags |= AI_ResponseParams::RG_DELAYBEFORESPEAK;
2065 rp->predelay.FromInterval( ReadInterval( token ) );
2066 continue;
2067 }
2068
2069 if ( !Q_stricmp( token, "nodelay" ) )
2070 {
2071 ParseToken();
2072 rp->flags |= AI_ResponseParams::RG_DELAYAFTERSPEAK;
2073 rp->delay.start = 0;
2074 rp->delay.range = 0;
2075 continue;
2076 }
2077
2078 if ( !Q_stricmp( token, "defaultdelay" ) )
2079 {
2080 rp->flags |= AI_ResponseParams::RG_DELAYAFTERSPEAK;
2081 rp->delay.start = AIS_DEF_MIN_DELAY;
2082 rp->delay.range = ( AIS_DEF_MAX_DELAY - AIS_DEF_MIN_DELAY );
2083 continue;
2084 }
2085
2086 if ( !Q_stricmp( token, "delay" ) )
2087 {
2088 ParseToken();
2089 rp->flags |= AI_ResponseParams::RG_DELAYAFTERSPEAK;
2090 rp->delay.FromInterval( ReadInterval( token ) );
2091 continue;
2092 }

Callers

nothing calls this directly

Calls 10

ComputeResponseTypeFunction · 0.85
ReadIntervalFunction · 0.85
clampFunction · 0.85
TextToSoundLevelFunction · 0.85
ParseTokenFunction · 0.70
CopyStringFunction · 0.70
TokenWaitingFunction · 0.70
SetFloatMethod · 0.45
FromIntervalMethod · 0.45
AddToTailMethod · 0.45

Tested by

no test coverage detected