File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,21 +12,41 @@ using namespace TAE;
1212
1313// For debugging unknowns that are written as "123 or 0.000"
1414int getUnknown (json::JSON value) {
15+ if (value.ToString () == " 1.000" ){
16+ int bp=42 ;
17+ }
18+
1519 if (value.JSONType () == json::JSON ::Class::Integral) {
1620 return value.ToInt ();
21+ }else if (value.JSONType () == json::JSON ::Class::Floating) {
22+ // fuck
23+ float floatValue = value.ToFloat ();
24+ int intValue;
25+ *(reinterpret_cast <float *>(&intValue)) = floatValue;
26+
27+ return intValue;
1728 }
1829
1930 std::string text = value.ToString ();
20- for (size_t n = 0 ; n < text.size (); ++n) {
21- if (text[n] == ' ' ) {
22- text.resize (n);
23- break ;
31+ bool isFloat = text.find (' .' ) != std::string::npos && text.find (' ' ) == std::string::npos;
32+ if (isFloat){
33+ float floatValue = (float )atof (text.c_str ());
34+ int intValue;
35+ *(reinterpret_cast <float *>(&intValue)) = floatValue;
36+
37+ return intValue;
38+ }else {
39+ for (size_t n = 0 ; n < text.size (); ++n) {
40+ if (text[n] == ' ' ) {
41+ text.resize (n);
42+ break ;
43+ }
2444 }
25- }
2645
27- int result = atoi (text.c_str ());
46+ int result = atoi (text.c_str ());
2847
29- return result;
48+ return result;
49+ }
3050}
3151
3252void getUnknownArray (json::JSON array, int * source, size_t size) {
You can’t perform that action at this time.
0 commit comments