Core/Misc: Another batch of fixes for issues found by static analysis

This commit is contained in:
Shauren
2013-05-19 11:31:17 +02:00
parent 7da33b6bce
commit 695c8cd7b4
3 changed files with 51 additions and 49 deletions

View File

@@ -1033,7 +1033,7 @@ void BattlegroundMgr::ScheduleQueueUpdate(uint32 arenaMatchmakerRating, uint8 ar
{
//This method must be atomic, @todo add mutex
//we will use only 1 number created of bgTypeId and bracket_id
uint64 const scheduleId = ((uint64)arenaMatchmakerRating << 32) | (arenaType << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | bracket_id;
uint64 const scheduleId = ((uint64)arenaMatchmakerRating << 32) | (uint32(arenaType) << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | bracket_id;
if (std::find(m_QueueUpdateScheduler.begin(), m_QueueUpdateScheduler.end(), scheduleId) == m_QueueUpdateScheduler.end())
m_QueueUpdateScheduler.push_back(scheduleId);
}

View File

@@ -159,20 +159,20 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
PreparedStatement* stmt;
MailDraft mail(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody());
CalendarInviteStore::iterator itr = _invites[eventId].begin();
while (itr != _invites[eventId].end())
CalendarInviteStore& eventInvites = _invites[eventId];
for (size_t i = 0; i < eventInvites.size(); ++i)
{
CalendarInvite* invite = eventInvites[i];
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE);
stmt->setUInt64(0, (*itr)->GetInviteId());
stmt->setUInt64(0, invite->GetInviteId());
trans->Append(stmt);
// guild events only? check invite status here?
// When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki)
if (remover && (*itr)->GetInviteeGUID() != remover)
mail.SendMailTo(trans, MailReceiver((*itr)->GetInviteeGUID()), calendarEvent, MAIL_CHECK_MASK_COPIED);
if (remover && invite->GetInviteeGUID() != remover)
mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID()), calendarEvent, MAIL_CHECK_MASK_COPIED);
delete *itr;
_invites[eventId].erase(itr);
delete invite;
}
_invites.erase(eventId);

View File

@@ -146,49 +146,51 @@ class boss_kirtonos_the_herald : public CreatureScript
{
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent() && !UpdateVictim())
{
switch (eventId)
{
case INTRO_1:
me->GetMotionMaster()->MovePath(KIRTONOS_PATH, false);
break;
case INTRO_2:
me->GetMotionMaster()->MovePoint(0, PosMove[0]);
events.ScheduleEvent(INTRO_3, 1000);
break;
case INTRO_3:
if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS)))
gate->SetGoState(GO_STATE_READY);
me->SetFacingTo(0.01745329f);
events.ScheduleEvent(INTRO_4, 3000);
break;
case INTRO_4:
if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD)))
brazier->SetGoState(GO_STATE_READY);
me->SetWalk(true);
me->SetDisableGravity(false);
DoCast(me, SPELL_KIRTONOS_TRANSFORM);
me->SetCanFly(false);
events.ScheduleEvent(INTRO_5, 1000);
break;
case INTRO_5:
me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF));
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
events.ScheduleEvent(INTRO_6, 5000);
break;
case INTRO_6:
me->GetMotionMaster()->MovePoint(0, PosMove[1]);
break;
default:
break;
}
}
if (!UpdateVictim())
{
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case INTRO_1:
me->GetMotionMaster()->MovePath(KIRTONOS_PATH, false);
break;
case INTRO_2:
me->GetMotionMaster()->MovePoint(0, PosMove[0]);
events.ScheduleEvent(INTRO_3, 1000);
break;
case INTRO_3:
if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS)))
gate->SetGoState(GO_STATE_READY);
me->SetFacingTo(0.01745329f);
events.ScheduleEvent(INTRO_4, 3000);
break;
case INTRO_4:
if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD)))
brazier->SetGoState(GO_STATE_READY);
me->SetWalk(true);
me->SetDisableGravity(false);
DoCast(me, SPELL_KIRTONOS_TRANSFORM);
me->SetCanFly(false);
events.ScheduleEvent(INTRO_5, 1000);
break;
case INTRO_5:
me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF));
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
events.ScheduleEvent(INTRO_6, 5000);
break;
case INTRO_6:
me->GetMotionMaster()->MovePoint(0, PosMove[1]);
break;
default:
break;
}
}
return;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;