Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. if (event.key.keysym.sym == SDLK_b) { // ce prtisnemo b
  2. bool ena;
  3.  
  4. ifstream dat("prazna.bin", ios::binary);
  5. if (dat.is_open())
  6. {
  7. dat.read((char *)&ena, sizeof(ena));
  8. if (ena == 1) {
  9. GameRunning = 0;
  10. MenuRunning = 0;
  11. prebrano2 = 1;
  12. }
  13. else {
  14.  
  15.  
  16.  
  17. dat.close();
  18. dat.open("enemy.bin", ios::binary);
  19. int i = 0;
  20. if (dat.is_open()) {
  21. xx tmp;
  22. list<xx>::iterator iterator = EnemyL.begin();
  23. bool okej = 1;
  24. if (EnemyL.size() == 0) okej = 0;
  25.  
  26. while (dat.read((char *)&tmp, sizeof(tmp))) {
  27. if (okej == 1) {
  28.  
  29.  
  30. if (iterator != EnemyL.end()) {
  31. iterator->x = tmp.x;
  32. iterator->y = tmp.y;
  33. iterator++;
  34. }
  35. else {
  36. iterator = EnemyL.begin();
  37. EnemyL.push_back(tmp);
  38. }
  39. }
  40. else {
  41. EnemyL.push_back(tmp);
  42. }
  43. }
  44. dat.close();
  45. }
  46.  
  47. dat.open("smeti.bin", ios::binary);
  48. if (dat.is_open()) {
  49. trash tmp;
  50. bool okej = 1;
  51. if (TrashL.size() == 0) {
  52. okej = 0;
  53. }
  54. list<trash>::iterator iterator = TrashL.begin();
  55. while (dat.read((char *)&tmp, sizeof(tmp))) {
  56. if (okej==1){
  57. if (iterator != TrashL.end()) {
  58. iterator->x = tmp.x;
  59. iterator->y = tmp.y;
  60. iterator++;
  61. }
  62. else {
  63. iterator = TrashL.begin();
  64. TrashL.push_back(tmp);
  65. }
  66. }
  67. else {
  68. TrashL.push_back(tmp);
  69. }
  70. }
  71. dat.close();
  72. }
  73.  
  74. dat.open("ally.bin", ios::binary);
  75. if (dat.is_open()) {
  76. ally tmp;
  77. bool okej = 1;
  78. if (AllyL.size() == 0) {
  79. okej = 0;
  80. }
  81. list<ally>::iterator iterator = AllyL.begin();
  82. while (dat.read((char *)&tmp, sizeof(tmp))) {
  83. if (okej == 1) {
  84. if (iterator != AllyL.end()) {
  85. iterator->x = tmp.x;
  86. iterator->y = tmp.y;
  87. iterator++;
  88. }
  89. else {
  90. iterator = AllyL.begin();
  91. AllyL.push_back(tmp);
  92. }
  93. }
  94. else {
  95. AllyL.push_back(tmp);
  96. }
  97. }
  98. dat.close();
  99. }
  100.  
  101. dat.open("player.bin", ios::binary);
  102. if (dat.is_open()) {
  103. dat.read((char *)&boat, sizeof(boat));
  104. dat.close();
  105. }
  106.  
  107. dat.open("tocke.bin", ios::binary);
  108. if (dat.is_open()) {
  109. dat.read((char *)&tocke, sizeof(tocke));
  110. dat.close();
  111. }
  112. MenuRunning = 0;
  113. }
  114.  
  115. }
  116. else {
  117. return 0;
  118. }
  119.  
  120.  
  121.  
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement