Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. class Room_List
  2. {
  3.  
  4. node Node;
  5.  
  6. public:
  7.  
  8.  
  9. Room_List()
  10. {
  11. Node.Current=NULL;
  12. Node.Next=NULL;
  13. };
  14. void Add_to_Room_List( Room* room)
  15. {
  16. node *n=&(this->Node);
  17. while(n->Next!=NULL)
  18. n=n->Next;
  19.  
  20. if(n->Current!=NULL)
  21. {
  22. node *tmp=(node*)malloc(sizeof(node));
  23. tmp->Next=NULL;
  24. tmp->Current=room;
  25. n->Next=tmp;
  26. }
  27. else
  28. {
  29. n->Current=room;
  30. n->Next=NULL;
  31. }
  32. };
  33. ~Room_List()
  34. {
  35. node *N=&(this->Node);
  36. node *tmp=N;
  37. while(N->Next!=NULL)
  38. {
  39. N=N->Next;
  40. cout<<"tmp";//поиск места ошибки
  41. free(tmp);
  42. tmp=N;
  43. }
  44. cout<<"N error";//поиск места ошибки
  45. free(N);
  46. };
  47. };
  48. //Room-другой класс
  49. class Room
  50. {
  51. friend class Room_List;
  52. protected:
  53. COORD OO;
  54. COORD XY;
  55. COORD_Matrix Doors;
  56. Character_Matrix Enemies;//здесь только поля без методов
  57. //...
  58. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement