MCPcopy Create free account
hub / github.com/JACoders/OpenJK / UI_ParseColorData

Function UI_ParseColorData

code/ui/ui_main.cpp:2328–2381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2326}
2327
2328static qboolean UI_ParseColorData(char* buf, playerSpeciesInfo_t &species)
2329{
2330 const char *token;
2331 const char *p;
2332
2333 p = buf;
2334 COM_BeginParseSession();
2335 species.ColorCount = 0;
2336 species.ColorMax = 16;
2337 species.Color = (playerColor_t *)malloc(species.ColorMax * sizeof(playerColor_t));
2338
2339 while ( p )
2340 {
2341 token = COM_ParseExt( &p, qtrue ); //looking for the shader
2342 if ( token[0] == 0 )
2343 {
2344 COM_EndParseSession( );
2345 return (qboolean)(species.ColorCount != 0);
2346 }
2347
2348 if (species.ColorCount >= species.ColorMax)
2349 {
2350 species.ColorMax *= 2;
2351 species.Color = (playerColor_t *)realloc(species.Color, species.ColorMax * sizeof(playerColor_t));
2352 }
2353
2354 memset(&species.Color[species.ColorCount], 0, sizeof(playerColor_t));
2355
2356 Q_strncpyz( species.Color[species.ColorCount].shader, token, MAX_QPATH );
2357
2358 token = COM_ParseExt( &p, qtrue ); //looking for action block {
2359 if ( token[0] != '{' )
2360 {
2361 COM_EndParseSession( );
2362 return qfalse;
2363 }
2364
2365 token = COM_ParseExt( &p, qtrue ); //looking for action commands
2366 while (token[0] != '}')
2367 {
2368 if ( token[0] == 0)
2369 { //EOF
2370 COM_EndParseSession( );
2371 return qfalse;
2372 }
2373 Q_strcat(species.Color[species.ColorCount].actionText, ACTION_BUFFER_SIZE, token);
2374 Q_strcat(species.Color[species.ColorCount].actionText, ACTION_BUFFER_SIZE, " ");
2375 token = COM_ParseExt( &p, qtrue ); //looking for action commands or final }
2376 }
2377 species.ColorCount++; //next color please
2378 }
2379 COM_EndParseSession( );
2380 return qtrue;//never get here
2381}
2382
2383/*
2384=================

Callers 1

UI_BuildPlayerModel_ListFunction · 0.70

Calls 5

COM_EndParseSessionFunction · 0.85
Q_strncpyzFunction · 0.85
Q_strcatFunction · 0.85
COM_BeginParseSessionFunction · 0.50
COM_ParseExtFunction · 0.50

Tested by

no test coverage detected