mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
1
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
#include "mathlib/mathlib.h"
|
||||
#include "util.h"
|
||||
#include "tier1/strtools.h"
|
||||
|
||||
void UTIL_StringToFloatArray( float *pVector, int count, const char *pString )
|
||||
{
|
||||
char *pstr, *pfront, tempString[128];
|
||||
int j;
|
||||
|
||||
Q_strncpy( tempString, pString, sizeof(tempString) );
|
||||
pstr = pfront = tempString;
|
||||
|
||||
for ( j = 0; j < count; j++ ) // lifted from pr_edict.c
|
||||
{
|
||||
pVector[j] = atof( pfront );
|
||||
|
||||
// skip any leading whitespace
|
||||
while ( *pstr && *pstr <= ' ' )
|
||||
pstr++;
|
||||
|
||||
// skip to next whitespace
|
||||
while ( *pstr && *pstr > ' ' )
|
||||
pstr++;
|
||||
|
||||
if (!*pstr)
|
||||
break;
|
||||
|
||||
pstr++;
|
||||
pfront = pstr;
|
||||
}
|
||||
for ( j++; j < count; j++ )
|
||||
{
|
||||
pVector[j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void UTIL_StringToVector( float *pVector, const char *pString )
|
||||
{
|
||||
UTIL_StringToFloatArray( pVector, 3, pString );
|
||||
}
|
||||
Reference in New Issue
Block a user