1. unsigned int
  2. sp_svg_satellite_vector_read_d(gchar const *str, std::vector<Satellite> *subpath_satellites){
  3. if (!str) {
  4. return 0;
  5. }
  6. gchar ** strarray = g_strsplit(str, " @ ", 0);
  7. gchar ** iter = strarray;
  8. while (*iter != NULL) {
  9. gchar ** strsubarray = g_strsplit(*iter, ",", 7);
  10. if(strlen(str) > 0 && strsubarray[6] && !strsubarray[7]){
  11. Satellite satellite;
  12. satellite.setSatelliteType(g_strstrip(strsubarray[0]));
  13. satellite.is_time = strncmp(strsubarray[1],"1",1) == 0;
  14. satellite.has_mirror = strncmp(strsubarray[2],"1",1) == 0;
  15. satellite.hidden = strncmp(strsubarray[3],"1",1) == 0;
  16. double amount,angle;
  17. float stepsTmp;
  18. sp_svg_number_read_d(strsubarray[4], &amount);
  19. sp_svg_number_read_d(strsubarray[5], &angle);
  20. sp_svg_number_read_f(strsubarray[6], &stepsTmp);
  21. unsigned int steps = (unsigned int)stepsTmp;
  22. satellite.amount = amount;
  23. satellite.angle = angle;
  24. satellite.steps = steps;
  25. subpath_satellites->push_back(satellite);
  26. }
  27. g_strfreev (strsubarray);
  28. iter++;
  29. }
  30. g_strfreev (strarray);
  31. if (!subpath_satellites->empty()){
  32. return 1;
  33. }
  34. return 0;
  35. }
 
 

35

 

842

Pasted Text #1598

-

PasteBin

Lines
35
Words
105
Size
1,3 KB
Created
Tipe
text/plain
Public Domain (PD)
Please log in to leave a comment!