Permalink
Browse files

Core/Misc: Fixed a few warning found by static analysis tools.

  • Loading branch information...
Shauren committed Feb 1, 2013
1 parent 0bf29d4 commit 957375c7ff760742fcfa4d141a1e42aa0dd9825b
@@ -2209,6 +2209,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
return;
}
+ uint32 loaded = 0;
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
{
AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(entryId);
@@ -2220,9 +2221,11 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
if (criteria->timeLimit)
m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria);
+
+ ++loaded;
}
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement criteria in %u ms", loaded, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementReferenceList()
@@ -2284,14 +2287,14 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
}
uint32 dataType = fields[1].GetUInt8();
- const char* scriptName = fields[4].GetCString();
+ std::string scriptName = fields[4].GetString();
uint32 scriptId = 0;
- if (strcmp(scriptName, "")) // not empty
+ if (scriptName.length()) // not empty
{
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
else
- scriptId = sObjectMgr->GetScriptId(scriptName);
+ scriptId = sObjectMgr->GetScriptId(scriptName.c_str());
}
AchievementCriteriaData data(dataType, fields[2].GetUInt32(), fields[3].GetUInt32(), scriptId);
@@ -3345,22 +3345,19 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint
Unit* target = aurApp->GetTarget();
- target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
// when removing flag aura, handle flag drop
- if (!apply && target->GetTypeId() == TYPEID_PLAYER
- && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
+ Player* player = target->ToPlayer();
+ if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
{
- if (target->GetTypeId() == TYPEID_PLAYER)
+ if (player->InBattleground())
{
- if (target->ToPlayer()->InBattleground())
- {
- if (Battleground* bg = target->ToPlayer()->GetBattleground())
- bg->EventPlayerDroppedFlag(target->ToPlayer());
- }
- else
- sOutdoorPvPMgr->HandleDropFlag((Player*)target, GetSpellInfo()->Id);
+ if (Battleground* bg = player->GetBattleground())
+ bg->EventPlayerDroppedFlag(player);
}
+ else
+ sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
}
}
@@ -2858,8 +2858,6 @@ void World::ResetMonthlyQuests()
if (itr->second->GetPlayer())
itr->second->GetPlayer()->ResetMonthlyQuestStatus();
- time_t mostRecentQuestTime = 0;
-
// generate time
time_t curTime = time(NULL);
tm localTm = *localtime(&curTime);
@@ -2889,11 +2887,8 @@ void World::ResetMonthlyQuests()
// last reset time before current moment
time_t resetTime = (curTime < nextMonthResetTime) ? nextMonthResetTime - MONTH : nextMonthResetTime;
- // need reset (if we have quest time before last reset time (not processed by some reason)
- if (mostRecentQuestTime && mostRecentQuestTime <= resetTime)
- m_NextMonthlyQuestReset = mostRecentQuestTime;
- else // plan next reset time
- m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
+ // plan next reset time
+ m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
sWorld->setWorldState(WS_MONTHLY_QUEST_RESET_TIME, uint64(m_NextMonthlyQuestReset));
}

0 comments on commit 957375c

Please sign in to comment.