Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/Calendar.h b/src/game/Calendar.h
- index 10b75b5..3f3b33b 100644
- --- a/src/game/Calendar.h
- +++ b/src/game/Calendar.h
- @@ -19,8 +19,86 @@
- #ifndef MANGOS_CALENDAR_H
- #define MANGOS_CALENDAR_H
- +#include "Common.h"
- +#include "ObjectGuid.h"
- +#include "Policies/Singleton.h"
- +#include <ace/RW_Thread_Mutex.h>
- +
- +struct CalendarEventInvite
- +{
- + std::string m_Name;
- + ObjectGuid m_eventGuid;
- + ObjectGuid m_inviterGuid;
- + ObjectGuid m_playerGuid;
- + uint8 unk12;
- + uint8 unk13;
- +};
- +
- +typedef std::set<CalendarEventInvite*> EventInvitesList;
- +
- +struct CalendarEvent
- +{
- + ObjectGuid m_guid;
- + ObjectGuid m_creatorGuid;
- + std::string m_eventName;
- + std::string m_eventDescription;
- + uint8 m_eventType;
- + uint8 unk4;
- + uint32 unk5;
- + uint32 m_instance;
- + uint32 m_time;
- + uint32 unk8;
- + uint32 m_flags;
- + EventInvitesList inviteList;
- +};
- +
- +typedef std::multimap<ObjectGuid, CalendarEventInvite> CalendarEventInviteMap;
- +typedef std::map<ObjectGuid, CalendarEvent> CalendarEventMap;
- +typedef std::multimap<uint32, HolidaysEntry const*> HolidaysList;
- +
- +typedef std::queue<ObjectGuid> EventsQueue;
- +typedef std::queue<CalendarEventInvite*> InviteQueue;
- +
- +typedef std::pair<HolidaysList::const_iterator,HolidaysList::const_iterator> HolidaysListBounds;
- +typedef std::pair<CalendarEventInviteMap::const_iterator,CalendarEventInviteMap::const_iterator> CalendarEventInviteBounds;
- +
- class Calendar
- {
- + public:
- + Calendar();
- + ~Calendar();
- + void Initialize();
- + void Update();
- +
- + // searching
- + CalendarEvent* GetEvent(ObjectGuid eventGuid);
- + EventInvitesList GetInvitesForPlayer(ObjectGuid playerGuid);
- +
- + // save/load operations
- + CalendarResponseResult AddEvent(CalendarEvent* event);
- + void SaveEvent(ObjectGuid guid);
- + CalendarResponseResult AddInvite(CalendarEventInvite* invite);
- + void SaveEvents();
- + void LoadEvents();
- + // DBC operations
- + HolidaysList GetHolidaysForRegion(uint32 region);
- +
- + // multithread locking
- + typedef ACE_RW_Thread_Mutex LockType;
- + typedef ACE_Read_Guard<LockType> ReadGuard;
- + typedef ACE_Write_Guard<LockType> WriteGuard;
- + LockType& GetLock() { return i_lock; }
- +
- + private:
- + LockType i_lock;
- + CalendarEventMap m_eventsMap; // Events storage
- + CalendarEventInviteMap m_invitesMap; // Invites storage
- + HolidaysList m_holidaysList; // Holidays, sorted by region
- + EventsQueue m_saveQueue; // Events save queue
- + EventsQueue m_deleteQueue; // Events delete queue
- };
- +
- +#define sCalendar MaNGOS::Singleton<Calendar>::Instance()
- +
- #endif
Add Comment
Please, Sign In to add comment