Merge pull request #5758 from GyxTom/master

Core/Game: Code style changes
This commit is contained in:
Lopin
2012-03-17 08:48:51 -07:00
13 changed files with 83 additions and 67 deletions
+4 -4
View File
@@ -70,11 +70,11 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
return false;
}
if ((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)))
if (chr->isDead() || chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
{
// if player is dead and stuck, send ghost to graveyard
chr->RepopAtGraveyard();
return true;
// if player is dead and stuck, send ghost to graveyard
chr->RepopAtGraveyard();
return true;
}
// cast spell Stuck
+7 -12
View File
@@ -42,7 +42,6 @@
bool ChatHandler::HandleNameAnnounceCommand(const char* args)
{
WorldPacket data;
if (!*args)
return false;
@@ -56,7 +55,6 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args)
bool ChatHandler::HandleGMNameAnnounceCommand(const char* args)
{
WorldPacket data;
if (!*args)
return false;
@@ -422,13 +420,10 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args)
std::string argstr = (char*)args;
Player* chr = getSelectedPlayer();
if (!chr)
{
chr=m_session->GetPlayer();
}
// check online security
else if (HasLowerSecurity(chr, 0))
if (!chr)
chr = m_session->GetPlayer();
else if (HasLowerSecurity(chr, 0)) // check online security
return false;
if (argstr == "on")
@@ -474,12 +469,12 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
wstrToLower (wnamepart);
// Search in AreaTable.dbc
for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag)
for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
{
AreaTableEntry const* areaEntry = sAreaStore.LookupEntry (areaflag);
AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag);
if (areaEntry)
{
int loc = GetSessionDbcLocale ();
int loc = GetSessionDbcLocale();
std::string name = areaEntry->area_name[loc];
if (name.empty())
continue;
@@ -489,7 +484,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
loc = 0;
for (; loc < TOTAL_LOCALES; ++loc)
{
if (loc == GetSessionDbcLocale ())
if (loc == GetSessionDbcLocale())
continue;
name = areaEntry->area_name[loc];
+3 -6
View File
@@ -175,7 +175,6 @@ bool ChatHandler::HandleItemMoveCommand(const char* args)
{
if (!*args)
return false;
uint8 srcslot, dstslot;
char* pParam1 = strtok((char*)args, " ");
if (!pParam1)
@@ -185,8 +184,8 @@ bool ChatHandler::HandleItemMoveCommand(const char* args)
if (!pParam2)
return false;
srcslot = (uint8)atoi(pParam1);
dstslot = (uint8)atoi(pParam2);
uint8 srcslot = (uint8)atoi(pParam1);
uint8 dstslot = (uint8)atoi(pParam2);
if (srcslot == dstslot)
return true;
@@ -279,7 +278,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
uint32 areaId;
uint32 phase = 0;
// get additional information from Player object
if (target)
{
@@ -756,7 +754,6 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args)
bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
{
if (!*args)
return false;
@@ -768,7 +765,7 @@ bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
QueryResult result = LoginDatabase.PQuery ("SELECT id, username FROM account WHERE email = '%s'", email.c_str ());
return LookupPlayerSearchCommand (result, limit);
return LookupPlayerSearchCommand(result, limit);
}
bool ChatHandler::LookupPlayerSearchCommand(QueryResult result, int32 limit)
+12 -19
View File
@@ -87,11 +87,10 @@ bool ChatHandler::HandleSetSkillCommand(const char *args)
return false;
char *level_p = strtok (NULL, " ");
if (!level_p)
return false;
char *max_p = strtok (NULL, " ");
char *max_p = strtok (NULL, " ");
int32 skill = atoi(skill_p);
if (skill <= 0)
@@ -128,7 +127,7 @@ bool ChatHandler::HandleSetSkillCommand(const char *args)
return false;
}
int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill);
int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill);
if (level <= 0 || level > max || max <= 0)
return false;
@@ -631,7 +630,7 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
QueryResult result;
uint32 obj_count = 0;
result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id);
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id);
if (result)
obj_count = (*result)[0].GetUInt32();
@@ -703,7 +702,7 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
QueryResult result;
uint32 cr_count = 0;
result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id);
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id);
if (result)
cr_count = (*result)[0].GetUInt32();
@@ -2143,16 +2142,12 @@ bool ChatHandler::HandleExploreCheatCommand(const char *args)
ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, GetNameLink().c_str());
}
for (uint8 i=0; i<PLAYER_EXPLORED_ZONES_SIZE; ++i)
for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
{
if (flag != 0)
{
m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
}
else
{
m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
}
}
return true;
@@ -2434,7 +2429,9 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
{
Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i));
if (uAuraList.empty()) continue;
if (uAuraList.empty())
continue;
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
{
@@ -2739,7 +2736,7 @@ bool ChatHandler::HandleServerShutDownCommand(const char *args)
if (exitcode < 0 || exitcode > 125)
return false;
sWorld->ShutdownServ (time, 0, exitcode);
sWorld->ShutdownServ(time, 0, exitcode);
}
else
sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE);
@@ -2774,7 +2771,7 @@ bool ChatHandler::HandleServerRestartCommand(const char *args)
if (exitcode < 0 || exitcode > 125)
return false;
sWorld->ShutdownServ (time, SHUTDOWN_MASK_RESTART, exitcode);
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitcode);
}
else
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE);
@@ -2809,7 +2806,7 @@ bool ChatHandler::HandleServerIdleRestartCommand(const char *args)
if (exitcode < 0 || exitcode > 125)
return false;
sWorld->ShutdownServ (time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode);
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode);
}
else
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE);
@@ -2844,7 +2841,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char *args)
if (exitcode < 0 || exitcode > 125)
return false;
sWorld->ShutdownServ (time, SHUTDOWN_MASK_IDLE, exitcode);
sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitcode);
}
else
sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE);
@@ -4494,10 +4491,6 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args)
return true;
}
/*------------------------------------------
*-------------TRINITY----------------------
*-------------------------------------*/
bool ChatHandler::HandlePlayAllCommand(const char *args)
{
if (!*args)
+3 -1
View File
@@ -474,7 +474,9 @@ void LoadDBCStores(const std::string& dataPath)
for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i)
{
TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo) continue;
if (!talentInfo)
continue;
for (int j = 0; j < MAX_TALENT_RANK; j++)
if (talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j);
@@ -1695,13 +1695,14 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
(spellInfo->Effects[j].Effect == SPELL_EFFECT_INSTAKILL) ||
(spellInfo->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
(spellInfo->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH)
)
)
{
bcontinue = false;
break;
}
}
if (bcontinue) continue;
if (bcontinue)
continue;
if (spellInfo->ManaCost > GetPower(POWER_MANA))
continue;
@@ -1744,7 +1745,8 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
break;
}
}
if (bcontinue) continue;
if (bcontinue)
continue;
if (spellInfo->ManaCost > GetPower(POWER_MANA))
continue;
+2 -1
View File
@@ -1336,7 +1336,8 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
{
for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
if (itr2->second.state == PETSPELL_REMOVED) continue;
if (itr2->second.state == PETSPELL_REMOVED)
continue;
SpellInfo const* oldRankSpellInfo = sSpellMgr->GetSpellInfo(itr2->first);
+26 -13
View File
@@ -3692,9 +3692,12 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
{
for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
if (itr2->second->state == PLAYERSPELL_REMOVED) continue;
if (itr2->second->state == PLAYERSPELL_REMOVED)
continue;
SpellInfo const* i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first);
if (!i_spellInfo) continue;
if (!i_spellInfo)
continue;
if (spellInfo->IsDifferentRankOf(i_spellInfo))
{
@@ -8293,7 +8296,9 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
{
uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant) continue;
if (!pEnchant)
continue;
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
{
if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
@@ -11165,7 +11170,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
Item* pItem = pItems[k];
// no item
if (!pItem) continue;
if (!pItem)
continue;
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount());
ItemTemplate const* pProto = pItem->GetTemplate();
@@ -11204,7 +11210,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
break;
}
}
if (b_found) continue;
if (b_found)
continue;
for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
{
@@ -11216,7 +11223,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
break;
}
}
if (b_found) continue;
if (b_found)
continue;
for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t)
{
@@ -11228,7 +11236,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
break;
}
}
if (b_found) continue;
if (b_found)
continue;
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{
@@ -11249,7 +11258,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
}
}
}
if (b_found) continue;
if (b_found)
continue;
}
// special bag case
@@ -11270,7 +11280,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
}
}
if (b_found) continue;
if (b_found)
continue;
if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
{
@@ -11285,7 +11296,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
}
}
if (b_found) continue;
if (b_found)
continue;
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{
@@ -11309,7 +11321,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
}
}
}
if (b_found) continue;
if (b_found)
continue;
}
// search free slot
@@ -11323,7 +11336,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
break;
}
}
if (b_found) continue;
if (b_found)
continue;
// search free slot in bags
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
@@ -23353,7 +23367,6 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost)
GetSession()->SendPacket(&data);
}
/*-----------------------TRINITY--------------------------*/
bool Player::isTotalImmunity()
{
AuraEffectList const& immune = GetAuraEffectsByType(SPELL_AURA_SCHOOL_IMMUNITY);
@@ -216,7 +216,8 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* member = itr->getSource();
if (!member) continue; // this should never happen
if (!member)
continue; // this should never happen
WorldPacket data;
+2 -1
View File
@@ -643,7 +643,8 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32
uint32 result2 = 0;
uint32 quest_id = i->second;
Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
if (!quest) continue;
if (!quest)
continue;
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId());
if (!sConditionMgr->IsObjectMeetToConditions(player, conditions))
@@ -1462,10 +1462,16 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
const PlayerSpellMap& sp_list = target->ToPlayer()->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue;
if (itr->first == spellId || itr->first == spellId2) continue;
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
continue;
if (itr->first == spellId || itr->first == spellId2)
continue;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) continue;
if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)))
continue;
if (spellInfo->Stances & (1<<(GetMiscValue()-1)))
target->CastSpell(target, itr->first, true, NULL, this);
}
@@ -2069,7 +2075,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue;
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
continue;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
+3 -1
View File
@@ -4038,7 +4038,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
while (bag) // 256 = 0 due to var type
{
item = m_caster->ToPlayer()->GetItemByPos(bag, slot);
if (item && item->GetEntry() == 38587) break;
if (item && item->GetEntry() == 38587)
break;
++slot;
if (slot == 39)
{
+2 -1
View File
@@ -452,7 +452,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
{
if (!fgets(buf, 32000, fin))
{
if (feof(fin)) break;
if (feof(fin))
break;
ROLLBACK(DUMP_FILE_BROKEN);
}