Apply style fix pt3

This commit is contained in:
Antz 2020-01-13 10:14:05 +00:00
parent 1392c131e7
commit d93dbd95fe
191 changed files with 9851 additions and 676 deletions

View file

@ -130,20 +130,26 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang)
bool SpellClickInfo::IsFitToRequirements(Player const* player, Creature const* clickedCreature) const
{
if (conditionId)
{
return sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), clickedCreature, CONDITION_FROM_SPELLCLICK);
}
if (questStart)
{
// not in expected required quest state
if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
{
return false;
}
}
if (questEnd)
{
// not in expected forbidden quest state
if (!player || player->GetQuestRewardStatus(questEnd))
{
return false;
}
}
return true;
@ -220,7 +226,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const
{
ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
if (itr != mArenaTeamMap.end())
{
return itr->second;
}
return NULL;
}
@ -229,7 +237,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const
{
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
if (itr->second->GetName() == arenateamname)
{
return itr->second;
}
return NULL;
}
@ -238,7 +248,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamByCaptain(ObjectGuid guid) const
{
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
if (itr->second->GetCaptainGuid() == guid)
{
return itr->second;
}
return NULL;
}
@ -641,7 +653,9 @@ void ObjectMgr::LoadCreatureTemplates()
const_cast<CreatureInfo*>(cInfo)->ModelId[i] = 0;
}
else if (!displayScaleEntry)
{ displayScaleEntry = displayEntry; }
{
displayScaleEntry = displayEntry;
}
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->ModelId[i]);
if (!minfo)
@ -791,7 +805,9 @@ void ObjectMgr::LoadCreatureTemplates()
const_cast<CreatureInfo*>(cInfo)->Scale = displayScaleEntry->Scale;
}
else
{ const_cast<CreatureInfo*>(cInfo)->Scale = DEFAULT_OBJECT_SCALE; }
{
const_cast<CreatureInfo*>(cInfo)->Scale = DEFAULT_OBJECT_SCALE;
}
}
}
}
@ -1021,12 +1037,16 @@ void ObjectMgr::LoadCreatureClassLvlStats()
CreatureClassLvlStats const* ObjectMgr::GetCreatureClassLvlStats(uint32 level, uint32 unitClass, int32 expansion) const
{
if (expansion < 0)
{
return NULL;
}
CreatureClassLvlStats const* cCLS = &m_creatureClassLvlStats[level][classToIndex[unitClass]][expansion];
if (cCLS->BaseHealth != 0 && cCLS->BaseDamage > 0.1f)
{
return cCLS;
}
return NULL;
}
@ -1084,7 +1104,9 @@ void ObjectMgr::LoadEquipmentTemplates()
uint32 ObjectMgr::GetCreatureModelAlternativeModel(uint32 modelId) const
{
if (const CreatureModelInfo* modelInfo = GetCreatureModelInfo(modelId))
{
return modelInfo->modelid_alternative;
}
return 0;
}
@ -1107,10 +1129,14 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32 display_
return minfo; // not fatal, just use the previous one
}
else
{ return minfo_tmp; }
{
return minfo_tmp;
}
}
else
{ return minfo; }
{
return minfo;
}
}
uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask)
@ -1230,7 +1256,9 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}
else
{ sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f); }
{
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f);
}
if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_m))
{
@ -1257,7 +1285,9 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}
else
{ sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m); }
{
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m);
}
}
sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetRecordCount());
@ -3565,7 +3595,9 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, Pla
*info = pInfo->levelInfo[level - 1];
}
else
{ BuildPlayerLevelInfo(race, class_, level, info); }
{
BuildPlayerLevelInfo(race, class_, level, info);
}
}
void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const
@ -3816,7 +3848,9 @@ void ObjectMgr::LoadGroups()
mGroupMap.erase(itr++);
}
else
{ ++itr; }
{
++itr;
}
}
// -- loading instances --
@ -4368,7 +4402,9 @@ void ObjectMgr::LoadQuests()
qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this
}
else
{ choice_found = true; }
{
choice_found = true;
}
if (!qinfo->RewChoiceItemCount[j])
{
@ -4507,7 +4543,9 @@ void ObjectMgr::LoadQuests()
qinfo->RewMailDelaySecs = 0; // no mail will send to player
}
else
{ usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId(); }
{
usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId();
}
}
if (qinfo->NextQuestInChain)
@ -4520,7 +4558,9 @@ void ObjectMgr::LoadQuests()
qinfo->NextQuestInChain = 0;
}
else
{ qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId()); }
{
qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId());
}
}
// fill additional data stores
@ -6906,7 +6946,9 @@ void ObjectMgr::LoadPetNames()
PetHalfName1[entry].push_back(word);
}
else
{ PetHalfName0[entry].push_back(word); }
{
PetHalfName0[entry].push_back(word);
}
++count;
}
while (result->NextRow());
@ -7702,7 +7744,9 @@ void ObjectMgr::GetConditions(uint32 conditionId, std::vector<PlayerCondition co
{
const PlayerCondition* condition = sConditionStorage.LookupEntry<PlayerCondition>(conditionId);
if (!condition)
{
return;
}
if (condition->m_condition == CONDITION_OR || condition->m_condition == CONDITION_AND)
{
@ -7869,7 +7913,9 @@ void ObjectMgr::LoadGameobjectQuestRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7885,7 +7931,9 @@ void ObjectMgr::LoadGameobjectInvolvedRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7901,7 +7949,9 @@ void ObjectMgr::LoadCreatureQuestRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7917,7 +7967,9 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -8287,11 +8339,17 @@ inline void _DoStringError(int32 entry, char const* text, ...)
sLog.outErrorScriptLib("%s", buf);
}
else if (entry <= MIN_CREATURE_AI_TEXT_STRING_ID) // eventAI error
{ sLog.outErrorEventAI("%s", buf); }
{
sLog.outErrorEventAI("%s", buf);
}
else if (entry < MIN_DB_SCRIPT_STRING_ID) // mangos string error
{ sLog.outError("%s", buf); }
{
sLog.outError("%s", buf);
}
else // if (entry > MIN_DB_SCRIPT_STRING_ID) // DB script text error
{ sLog.outErrorDb("DB-SCRIPTS: %s", buf); }
{
sLog.outErrorDb("DB-SCRIPTS: %s", buf);
}
}
bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value, bool extra_content)
@ -8329,7 +8387,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
mMangosStringLocaleMap.erase(itr++);
}
else
{ ++itr; }
{
++itr;
}
}
sLog.outString("Loading texts from %s%s", table, extra_content ? ", with additional data" : "");
@ -8349,7 +8409,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Can not continue.", table);
}
else
{ sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table); }
{
sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table);
}
return false;
}
@ -8450,7 +8512,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
sLog.outString(">> Loaded %u MaNGOS strings from table %s", count, table);
}
else
{ sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table); }
{
sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table);
}
sLog.outString();
m_loadedStringCount[min_value] = count;
@ -8469,7 +8533,9 @@ const char* ObjectMgr::GetMangosString(int32 entry, int locale_idx) const
return msl->Content[locale_idx + 1].c_str();
}
else
{ return msl->Content[0].c_str(); }
{
return msl->Content[0].c_str();
}
}
_DoStringError(entry, "Entry %i not found but requested", entry);
@ -8537,10 +8603,14 @@ bool ObjectMgr::CheckDeclinedNames(const std::wstring& mainpart, DeclinedName co
{
std::wstring wname;
if (!Utf8toWStr(names.name[i], wname))
{
return false;
}
if (mainpart != GetMainPartOfName(wname, i + 1))
{
return false;
}
}
return true;
}
@ -8609,7 +8679,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return true;
}
else
{ return uint32(player->GetTeam()) == m_value1; }
{
return uint32(player->GetTeam()) == m_value1;
}
}
case CONDITION_SKILL:
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) >= m_value2;
@ -8799,7 +8871,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return !player->HasSkill(m_value1);
}
else
{ return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2; }
{
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2;
}
}
case CONDITION_REPUTATION_RANK_MAX:
{
@ -8892,7 +8966,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return true;
}
else
{ return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2)); }
{
return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2));
}
case 2: // All players in instance dead or out of range
for (Map::PlayerList::const_iterator itr = map->GetPlayers().begin(); itr != map->GetPlayers().end(); ++itr)
{
@ -9456,9 +9532,13 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial)
return SKILL_RANGE_RANK;
}
else if (racial)
{ return SKILL_RANGE_NONE; }
{
return SKILL_RANGE_NONE;
}
else
{ return SKILL_RANGE_MONO; }
{
return SKILL_RANGE_MONO;
}
default:
case SKILL_CATEGORY_ATTRIBUTES: // not found in dbc
case SKILL_CATEGORY_GENERIC: // only GENERIC(DND)
@ -9546,7 +9626,9 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
return &itr->second;
}
else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos)
{ alt = &itr->second; }
{
alt = &itr->second;
}
return alt;
}
@ -10208,7 +10290,9 @@ void ObjectMgr::LoadGossipMenuItems(std::set<uint32>& gossipScriptSet)
sLog.outErrorDb("Gossip menu option (MenuId: %u Id: %u) have action_menu_id = %u for nonexistent menu", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_menu_id);
}
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
{ menu_ids.erase(gMenuItem.action_menu_id); }
{
menu_ids.erase(gMenuItem.action_menu_id);
}
}
if (gMenuItem.option_icon >= GOSSIP_ICON_MAX)
@ -10306,7 +10390,9 @@ void ObjectMgr::LoadGossipMenus()
{
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
if (!scm)
{
return;
}
// Check which script-ids in db_scripts type DBS_ON_GOSSIP are not used
std::set<uint32> gossipScriptSet;
@ -10894,7 +10980,9 @@ bool FindCreatureData::operator()(CreatureDataPair const& dataPair)
// skip not spawned (in any state),
uint16 pool_id = sPoolMgr.IsPartOfAPool<Creature>(dataPair.first);
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<Creature>(dataPair.first))
{
return false;
}
if (!i_spawnedData || new_dist < i_spawnedDist)
{
@ -10930,7 +11018,9 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL*
}
}
else
{ source->PlayDirectSound(data->SoundId); }
{
source->PlayDirectSound(data->SoundId);
}
}
if (data->Emote)
@ -10959,10 +11049,14 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL*
CreatureDataPair const* FindCreatureData::GetResult() const
{
if (i_spawnedData)
{
return i_spawnedData;
}
if (i_mapData)
{
return i_mapData;
}
return i_anyData;
}
@ -10971,18 +11065,24 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
{
// skip wrong entry ids
if (i_id && dataPair.second.id != i_id)
{
return false;
}
if (!i_anyData)
i_anyData = &dataPair;
// without player we can't find more stricted cases, so use fouded
if (!i_player)
{
return true;
}
// skip diff. map cases
if (dataPair.second.mapid != i_player->GetMapId())
{
return false;
}
float new_dist = i_player->GetDistance2d(dataPair.second.posX, dataPair.second.posY);
@ -10995,7 +11095,9 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
// skip not spawned (in any state)
uint16 pool_id = sPoolMgr.IsPartOfAPool<GameObject>(dataPair.first);
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<GameObject>(dataPair.first))
{
return false;
}
if (!i_spawnedData || new_dist < i_spawnedDist)
{
@ -11009,10 +11111,14 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
GameObjectDataPair const* FindGOData::GetResult() const
{
if (i_mapData)
{
return i_mapData;
}
if (i_spawnedData)
{
return i_spawnedData;
}
return i_anyData;
}