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

Function LibVarStringValue

codemp/botlib/l_libvar.cpp:50–81  ·  view source on GitHub ↗

=========================================================================== Parameter: - Returns: - Changes Globals: - ===========================================================================

Source from the content-addressed store, hash-verified

48// Changes Globals: -
49//===========================================================================
50float LibVarStringValue(char *string)
51{
52 int dotfound = 0;
53 float value = 0;
54
55 while(*string)
56 {
57 if (*string < '0' || *string > '9')
58 {
59 if (dotfound || *string != '.')
60 {
61 return 0;
62 } //end if
63 else
64 {
65 dotfound = 10;
66 string++;
67 } //end if
68 } //end if
69 if (dotfound)
70 {
71 value = value + (float) (*string - '0') / (float) dotfound;
72 dotfound *= 10;
73 } //end if
74 else
75 {
76 value = value * 10.0 + (float) (*string - '0');
77 } //end else
78 string++;
79 } //end while
80 return value;
81} //end of the function LibVarStringValue
82//===========================================================================
83//
84// Parameter: -

Callers 2

LibVarFunction · 0.85
LibVarSetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected