Advertisement
Guest User

Untitled

a guest
Nov 26th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. #pragma once
  2.  
  3. /*
  4. ROUTER PLUGIN
  5. - GPS ADDITION TO SA-MP
  6. - Made By Gamer_Z a.k.a. grasmanek94 , Rafal Grasman
  7.  
  8. October-2011
  9.  
  10.  
  11. contact: grasmanek94@live.nl
  12.  
  13. http://gamer-gps.googlecode.com/
  14. */
  15.  
  16. #ifdef OS_WINDOWS
  17. void Thread::BackgroundCalculator( void *unused )
  18. #else
  19. void *Thread::BackgroundCalculator( void *unused )
  20. #endif
  21. {
  22. int startid;
  23. int endid;
  24. int extra;
  25. AMX *amx;
  26. vector <cell>way;
  27. int costx;
  28. while( true )
  29. {
  30. if(!QueueVector.empty())
  31. {
  32. Lock q (mutex_q);
  33. Lock p (mutex_p);
  34. if (q.acquire ())
  35. {
  36. startid = QueueVector.back().start;
  37. endid = QueueVector.back().end;
  38. extra = QueueVector.back().extraid;
  39. amx = QueueVector.back().script;
  40. QueueVector.pop_back();
  41. q.release();
  42. ///////////////////////////////////////
  43. /*LARGE_INTEGER frequency; // ticks per second
  44. LARGE_INTEGER t1, t2; // ticks
  45. double elapsedTime;
  46.  
  47. // get ticks per second
  48. QueryPerformanceFrequency(&frequency);
  49.  
  50. // start timer
  51. QueryPerformanceCounter(&t1);*/
  52. ///////////////////////////////////////
  53. dgraph->findPath_r(xNode[startid].NodeID ,xNode[endid].NodeID,way,costx);
  54. ///////////////////////////////////////
  55. //QueryPerformanceCounter(&t2);
  56. //elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
  57. ///////////////////////////////////////
  58. //cout << elapsedTime << " ms.\n";
  59. ///////////////////////////////////////
  60. dgraph->reset();
  61.  
  62. while(p.acquire () == false)
  63. {}
  64. PassVector.push(PassData(way.begin(),way.end(),extra,costx,amx));
  65. way.clear();
  66. costx = 0;
  67. p.release();
  68. }
  69. }
  70. SLEEP(30);
  71. //-------------------------
  72. }
  73.  
  74. EXIT_THREAD();//should be never reached..
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement