convert the first number in a input string to the out float if the string ends with [d/D] or [p/P] the out value will be converted from [d]ecimal or [p]ercent unit outside of class > will be moved external soon...
| 48 | // converted from [d]ecimal or [p]ercent unit |
| 49 | // outside of class > will be moved external soon... |
| 50 | BOOL strToFloatDegPcFail(const CHAR* cin, F32* out) |
| 51 | { |
| 52 | if (sscanf(cin, "%f", out) == 1) |
| 53 | { |
| 54 | if ((tolower(cin[strlen(cin) - 1]) == 'd') || ((unsigned char)cin[strlen(cin) - 1] == 0xb0)) // degree, '�' |
| 55 | { |
| 56 | *out /= 360; |
| 57 | } |
| 58 | if ((tolower(cin[strlen(cin) - 1]) == 'p') || (cin[strlen(cin) - 1] == '%')) |
| 59 | { |
| 60 | *out /= 100; |
| 61 | } |
| 62 | return false; |
| 63 | } |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | // range check |
| 68 | // outside of class > will be moved external soon... |