Guest User

Untitled

a guest
Jan 21st, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. diff --git a/src/game/Calendar.h b/src/game/Calendar.h
  2. index 10b75b5..3f3b33b 100644
  3. --- a/src/game/Calendar.h
  4. +++ b/src/game/Calendar.h
  5. @@ -19,8 +19,86 @@
  6. #ifndef MANGOS_CALENDAR_H
  7. #define MANGOS_CALENDAR_H
  8.  
  9. +#include "Common.h"
  10. +#include "ObjectGuid.h"
  11. +#include "Policies/Singleton.h"
  12. +#include <ace/RW_Thread_Mutex.h>
  13. +
  14. +struct CalendarEventInvite
  15. +{
  16. + std::string m_Name;
  17. + ObjectGuid m_eventGuid;
  18. + ObjectGuid m_inviterGuid;
  19. + ObjectGuid m_playerGuid;
  20. + uint8 unk12;
  21. + uint8 unk13;
  22. +};
  23. +
  24. +typedef std::set<CalendarEventInvite*> EventInvitesList;
  25. +
  26. +struct CalendarEvent
  27. +{
  28. + ObjectGuid m_guid;
  29. + ObjectGuid m_creatorGuid;
  30. + std::string m_eventName;
  31. + std::string m_eventDescription;
  32. + uint8 m_eventType;
  33. + uint8 unk4;
  34. + uint32 unk5;
  35. + uint32 m_instance;
  36. + uint32 m_time;
  37. + uint32 unk8;
  38. + uint32 m_flags;
  39. + EventInvitesList inviteList;
  40. +};
  41. +
  42. +typedef std::multimap<ObjectGuid, CalendarEventInvite> CalendarEventInviteMap;
  43. +typedef std::map<ObjectGuid, CalendarEvent> CalendarEventMap;
  44. +typedef std::multimap<uint32, HolidaysEntry const*> HolidaysList;
  45. +
  46. +typedef std::queue<ObjectGuid> EventsQueue;
  47. +typedef std::queue<CalendarEventInvite*> InviteQueue;
  48. +
  49. +typedef std::pair<HolidaysList::const_iterator,HolidaysList::const_iterator> HolidaysListBounds;
  50. +typedef std::pair<CalendarEventInviteMap::const_iterator,CalendarEventInviteMap::const_iterator> CalendarEventInviteBounds;
  51. +
  52. class Calendar
  53. {
  54. + public:
  55. + Calendar();
  56. + ~Calendar();
  57. + void Initialize();
  58. + void Update();
  59. +
  60. + // searching
  61. + CalendarEvent* GetEvent(ObjectGuid eventGuid);
  62. + EventInvitesList GetInvitesForPlayer(ObjectGuid playerGuid);
  63. +
  64. + // save/load operations
  65. + CalendarResponseResult AddEvent(CalendarEvent* event);
  66. + void SaveEvent(ObjectGuid guid);
  67. + CalendarResponseResult AddInvite(CalendarEventInvite* invite);
  68. + void SaveEvents();
  69. + void LoadEvents();
  70.  
  71. + // DBC operations
  72. + HolidaysList GetHolidaysForRegion(uint32 region);
  73. +
  74. + // multithread locking
  75. + typedef ACE_RW_Thread_Mutex LockType;
  76. + typedef ACE_Read_Guard<LockType> ReadGuard;
  77. + typedef ACE_Write_Guard<LockType> WriteGuard;
  78. + LockType& GetLock() { return i_lock; }
  79. +
  80. + private:
  81. + LockType i_lock;
  82. + CalendarEventMap m_eventsMap; // Events storage
  83. + CalendarEventInviteMap m_invitesMap; // Invites storage
  84. + HolidaysList m_holidaysList; // Holidays, sorted by region
  85. + EventsQueue m_saveQueue; // Events save queue
  86. + EventsQueue m_deleteQueue; // Events delete queue
  87. };
  88. +
  89. +#define sCalendar MaNGOS::Singleton<Calendar>::Instance()
  90. +
  91. #endif
Add Comment
Please, Sign In to add comment