Example #1
0
// remove all events and invite of player related to a specific guild
// used when player quit a guild
void CalendarMgr::RemoveGuildCalendar(ObjectGuid const& playerGuid, uint32 GuildId)
{
    CalendarEventStore::iterator itr = m_EventStore.begin();

    while (itr != m_EventStore.end())
    {
        CalendarEvent* event = &itr->second;
        if (event->CreatorGuid == playerGuid && (event->IsGuildEvent() || event->IsGuildAnnouncement()))
        {
            // all invite will be automaticaly deleted
            m_EventStore.erase(itr++);
            // itr already incremented so go recheck event owner
            continue;
        }

        // event not owned by playerGuid but an guild invite can still be found
        if (event->GuildId != GuildId || !(event->IsGuildEvent() || event->IsGuildAnnouncement()))
        {
            ++itr;
            continue;
        }

        event->RemoveInviteByGuid(playerGuid);
        ++itr;
    }
}
Example #2
0
// remove all events and invite of player
// used when player is deleted
void CalendarMgr::RemovePlayerCalendar(ObjectGuid const& playerGuid)
{
    CalendarEventStore::iterator itr = m_EventStore.begin();

    while (itr != m_EventStore.end())
    {
        if (itr->second.CreatorGuid == playerGuid)
        {
            // all invite will be automaticaly deleted
            m_EventStore.erase(itr++);
            // itr already incremented so go recheck event owner
            continue;
        }
        // event not owned by playerGuid but an invite can still be found
        CalendarEvent* event = &itr->second;
        event->RemoveInviteByGuid(playerGuid);
        ++itr;
    }
}