From e858057eff0ae3bffed44c6be8a41749cc43b777 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Mon, 13 May 2013 01:43:15 +0200 Subject: Core/Commands: Improve .damage command, now can damage destructible gameobjects => ".damage go " --- src/server/scripts/Commands/cs_misc.cpp | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 9fa143673ca..2a89411b2e5 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -2042,6 +2042,70 @@ public: if (!*args) return false; + char* str = strtok((char*)args, " "); + + if (strcmp(str, "go") == 0) + { + char* guidStr = strtok(NULL, " "); + if (!guidStr) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + int32 guid = atoi(guidStr); + if (!guid) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + char* damageStr = strtok(NULL, " "); + if (!damageStr) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + int32 damage = atoi(damageStr); + if (!damage) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + if (Player* player = handler->GetSession()->GetPlayer()) + { + GameObject* go = NULL; + + if (GameObjectData const* goData = sObjectMgr->GetGOData(guid)) + go = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guid, goData->id); + + if (!go) + { + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guid); + handler->SetSentErrorMessage(true); + return false; + } + + if (!go->IsDestructibleBuilding()) + { + handler->SendSysMessage(LANG_INVALID_GAMEOBJECT_TYPE); + handler->SetSentErrorMessage(true); + return false; + } + + go->ModifyHealth(-damage, player); + handler->PSendSysMessage(LANG_GAMEOBJECT_DAMAGED, go->GetName().c_str(), guid, -damage, go->GetGOValue()->Building.Health); + } + + return true; + } + Unit* target = handler->getSelectedUnit(); if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) { -- cgit v1.2.3 From 60dae46462205ff41a284faf6ac9cfd33d12b941 Mon Sep 17 00:00:00 2001 From: Nay Date: Thu, 16 May 2013 01:10:53 +0100 Subject: Core: Fix compiler warnings --- src/server/game/DataStores/DBCStores.cpp | 2 +- src/server/scripts/Commands/cs_deserter.cpp | 6 +++--- src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp | 2 ++ src/server/scripts/Northrend/zone_icecrown.cpp | 2 +- src/server/shared/Debugging/Errors.cpp | 4 ++++ 5 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 25419632a29..ebe3792420b 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -902,7 +902,7 @@ LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty) if (!dungeon) continue; - if (dungeon->map == mapId && Difficulty(dungeon->difficulty) == difficulty) + if (dungeon->map == (int)mapId && Difficulty(dungeon->difficulty) == difficulty) return dungeon; } diff --git a/src/server/scripts/Commands/cs_deserter.cpp b/src/server/scripts/Commands/cs_deserter.cpp index 3850456fcb3..ef2cd7b45b9 100644 --- a/src/server/scripts/Commands/cs_deserter.cpp +++ b/src/server/scripts/Commands/cs_deserter.cpp @@ -45,20 +45,20 @@ public: ChatCommand* GetCommands() const { - static ChatCommand deserterInstanceCommandTable[] = + static ChatCommand deserterInstanceCommandTable[] = { { "add", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceAdd, "", NULL }, { "remove", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceRemove, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; - static ChatCommand deserterBGCommandTable[] = + static ChatCommand deserterBGCommandTable[] = { { "add", SEC_ADMINISTRATOR, false, &HandleDeserterBGAdd, "", NULL }, { "remove", SEC_ADMINISTRATOR, false, &HandleDeserterBGRemove, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; - static ChatCommand deserterCommandTable[] = + static ChatCommand deserterCommandTable[] = { { "instance", SEC_ADMINISTRATOR, false, NULL, "", deserterInstanceCommandTable }, { "bg", SEC_ADMINISTRATOR, false, NULL, "", deserterBGCommandTable }, diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index 0d39fbf5505..64a315eb465 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -3078,10 +3078,12 @@ class spell_yogg_saron_in_the_maws_of_the_old_god : public SpellScriptLoader if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (Creature* yogg = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(BOSS_YOGG_SARON))) if (yogg->FindCurrentSpellBySpellId(SPELL_DEAFENING_ROAR)) + { if (GetCaster()->GetDistance(yogg) > 20.0f) return SPELL_FAILED_OUT_OF_RANGE; else return SPELL_CAST_OK; + } return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; } diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 70b500166c9..0447d70b502 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -921,7 +921,7 @@ class npc_frostbrood_skytalon : public CreatureScript if (id == POINT_GRAB_DECOY) if (TempSummon* summon = me->ToTempSummon()) if (Unit* summoner = summon->GetSummoner()) - DoCast(summoner, SPELL_GRAB); + DoCast(summoner, SPELL_GRAB); } void UpdateAI(uint32 diff) diff --git a/src/server/shared/Debugging/Errors.cpp b/src/server/shared/Debugging/Errors.cpp index 10ede3ae402..877d7554c43 100644 --- a/src/server/shared/Debugging/Errors.cpp +++ b/src/server/shared/Debugging/Errors.cpp @@ -20,6 +20,7 @@ #include #include +#include namespace Trinity { @@ -29,6 +30,7 @@ void Assert(char const *file, int line, char const *function, char const *messag fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", file, line, function, message, st.c_str()); *((volatile int*)NULL) = 0; + exit(1); } void Fatal(char const *file, int line, char const *function, char const *message) @@ -37,6 +39,7 @@ void Fatal(char const *file, int line, char const *function, char const *message file, line, function, message); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; + exit(1); } void Error(char const *file, int line, char const *function, char const *message) @@ -44,6 +47,7 @@ void Error(char const *file, int line, char const *function, char const *message fprintf(stderr, "\n%s:%i in %s ERROR:\n %s\n", file, line, function, message); *((volatile int*)NULL) = 0; + exit(1); } void Warning(char const *file, int line, char const *function, char const *message) -- cgit v1.2.3 From 7d4670341387568e89d21a8e0d702230e0ab962d Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 17 May 2013 21:30:02 +0200 Subject: Core/Misc: Another batch of fixes for issues found by static analysis --- src/server/collision/BoundingIntervalHierarchy.cpp | 2 +- src/server/collision/Management/MMapManager.cpp | 2 ++ src/server/game/AI/SmartScripts/SmartScript.cpp | 2 ++ src/server/game/Battlegrounds/ArenaTeam.cpp | 38 ++++++++++---------- src/server/game/Conditions/ConditionMgr.cpp | 12 +++++++ src/server/game/DataStores/DBCStores.cpp | 7 ++-- src/server/game/Entities/Player/Player.cpp | 3 +- src/server/game/Guilds/Guild.cpp | 4 +-- src/server/game/Handlers/CalendarHandler.cpp | 4 +-- src/server/game/Handlers/MiscHandler.cpp | 2 +- src/server/game/Handlers/TicketHandler.cpp | 1 + src/server/game/Loot/LootMgr.cpp | 12 +++---- src/server/game/Maps/Map.cpp | 6 ++-- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Spells/SpellEffects.cpp | 2 +- src/server/scripts/Commands/cs_rbac.cpp | 42 ++++++++++------------ 16 files changed, 75 insertions(+), 66 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp index 340d66ddaf0..c5ae1f2a265 100644 --- a/src/server/collision/BoundingIntervalHierarchy.cpp +++ b/src/server/collision/BoundingIntervalHierarchy.cpp @@ -272,7 +272,7 @@ bool BIH::readFromFile(FILE* rf) check += fread(&count, sizeof(uint32), 1, rf); objects.resize(count); // = new uint32[nObjects]; check += fread(&objects[0], sizeof(uint32), count, rf); - return check == (3 + 3 + 2 + treeSize + count); + return uint64(check) == uint64(3 + 3 + 1 + 1 + uint64(treeSize) + uint64(count)); } void BIH::BuildStats::updateLeaf(int depth, int n) diff --git a/src/server/collision/Management/MMapManager.cpp b/src/server/collision/Management/MMapManager.cpp index 70ae878aa6b..ac0a935dd39 100644 --- a/src/server/collision/Management/MMapManager.cpp +++ b/src/server/collision/Management/MMapManager.cpp @@ -123,6 +123,7 @@ namespace MMAP if (fread(&fileHeader, sizeof(MmapTileHeader), 1, file) != 1 || fileHeader.mmapMagic != MMAP_MAGIC) { TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:loadMap: Bad header in mmap %03u%02i%02i.mmtile", mapId, x, y); + fclose(file); return false; } @@ -130,6 +131,7 @@ namespace MMAP { TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:loadMap: %03u%02i%02i.mmtile was built with generator v%i, expected v%i", mapId, x, y, fileHeader.mmapVersion, MMAP_VERSION); + fclose(file); return false; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b4053da2932..b0b72b8c44a 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1470,8 +1470,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!einfo) { TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry()); + delete targets; return; } + npc->SetCurrentEquipmentId(equipId); slot[0] = einfo->ItemEntry[0]; slot[1] = einfo->ItemEntry[1]; diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 8ceeed90d92..af76ff71223 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -367,31 +367,31 @@ void ArenaTeam::Roster(WorldSession* session) uint8 unk308 = 0; WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100); - data << uint32(GetId()); // team id - data << uint8(unk308); // 308 unknown value but affect packet structure - data << uint32(GetMembersSize()); // members count - data << uint32(GetType()); // arena team type? + data << uint32(GetId()); // team id + data << uint8(unk308); // 3.0.8 unknown value but affect packet structure + data << uint32(GetMembersSize()); // members count + data << uint32(GetType()); // arena team type? for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { player = ObjectAccessor::FindPlayer(itr->Guid); - data << uint64(itr->Guid); // guid + data << uint64(itr->Guid); // guid data << uint8((player ? 1 : 0)); // online flag - data << itr->Name; // member name - data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member - data << uint8((player ? player->getLevel() : 0)); // unknown, level? - data << uint8(itr->Class); // class - data << uint32(itr->WeekGames); // played this week - data << uint32(itr->WeekWins); // wins this week - data << uint32(itr->SeasonGames); // played this season - data << uint32(itr->SeasonWins); // wins this season - data << uint32(itr->PersonalRating); // personal rating - if (unk308) - { - data << float(0.0f); // 308 unk - data << float(0.0f); // 308 unk - } + data << itr->Name; // member name + data << uint32((itr->Guid == GetCaptain() ? 0 : 1)); // captain flag 0 captain 1 member + data << uint8((player ? player->getLevel() : 0)); // unknown, level? + data << uint8(itr->Class); // class + data << uint32(itr->WeekGames); // played this week + data << uint32(itr->WeekWins); // wins this week + data << uint32(itr->SeasonGames); // played this season + data << uint32(itr->SeasonWins); // wins this season + data << uint32(itr->PersonalRating); // personal rating + //if (unk308) + //{ + // data << float(0.0f); // 308 unk + // data << float(0.0f); // 308 unk + //} } session->SendPacket(&data); diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 9b1cfed7038..67c81b35065 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -1110,6 +1110,9 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond) if ((1<= MAX_SPELL_EFFECTS) + return false; + // get shared data ConditionList* sharedList = spellInfo->Effects[firstEffIndex].ImplicitTargetConditions; @@ -1129,9 +1132,18 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond) { // add new list, create new shared mask sharedList = new ConditionList(); + bool assigned = false; for (uint8 i = firstEffIndex; i < MAX_SPELL_EFFECTS; ++i) + { if ((1<Effects[i].ImplicitTargetConditions = sharedList; + assigned = true; + } + } + + if (!assigned) + delete sharedList; } sharedList->push_back(cond); break; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index a00698bc527..84c9aeafaa0 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -508,10 +508,9 @@ void LoadDBCStores(const std::string& dataPath) continue; // store class talent tab pages - uint32 cls = 1; - for (uint32 m=1; !(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES; m <<= 1, ++cls) {} - - sTalentTabPages[cls][talentTabInfo->tabpage]=talentTabId; + for (uint32 cls = 1; cls < MAX_CLASSES; ++cls) + if (talentTabInfo->ClassMask & (1 << (cls - 1))) + sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId; } } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 353ba8f7f7c..83118e6ded7 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2549,8 +2549,9 @@ void Player::Regenerate(Powers power) case POWER_RUNE: case POWER_FOCUS: case POWER_HAPPINESS: - case POWER_HEALTH: break; + case POWER_HEALTH: + return; default: break; } diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 6f118126b3b..0369615da53 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -2571,7 +2571,7 @@ inline int32 Guild::_GetMemberRemainingSlots(Member const* member, uint8 tabId) uint8 rankId = member->GetRankId(); if (rankId == GR_GUILDMASTER) return GUILD_WITHDRAW_SLOT_UNLIMITED; - if ((_GetRankBankTabRights(rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GR_RIGHT_EMPTY) + if ((_GetRankBankTabRights(rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != 0) { int32 remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - member->GetBankWithdrawValue(tabId); if (remaining > 0) @@ -2589,7 +2589,7 @@ inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const if (rankId == GR_GUILDMASTER) return GUILD_WITHDRAW_MONEY_UNLIMITED; - if ((_GetRankRights(rankId) & (GR_RIGHT_WITHDRAW_REPAIR | GR_RIGHT_WITHDRAW_GOLD)) != GR_RIGHT_EMPTY) + if ((_GetRankRights(rankId) & (GR_RIGHT_WITHDRAW_REPAIR | GR_RIGHT_WITHDRAW_GOLD)) != 0) { int32 remaining = _GetRankBankMoneyPerDay(rankId) - member->GetBankWithdrawValue(GUILD_BANK_MAX_TABS); if (remaining > 0) diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index d0c8d3e3f1f..b47e085ab6c 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -446,8 +446,8 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) } // 946684800 is 01/01/2000 00:00:00 - default response time - CalendarInvite* invite = new CalendarInvite(inviteId, 0, inviteeGuid, playerGuid, 946684800, CALENDAR_STATUS_INVITED, CALENDAR_RANK_PLAYER, ""); - sCalendarMgr->SendCalendarEventInvite(*invite); + CalendarInvite invite(inviteId, 0, inviteeGuid, playerGuid, 946684800, CALENDAR_STATUS_INVITED, CALENDAR_RANK_PLAYER, ""); + sCalendarMgr->SendCalendarEventInvite(invite); } } diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index a17b455506a..088a13cd7c6 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -999,7 +999,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recvData) TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "RAD: type %u", type); - if (type > NUM_ACCOUNT_DATA_TYPES) + if (type >= NUM_ACCOUNT_DATA_TYPES) return; AccountData* adata = GetAccountData(AccountDataType(type)); diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index d39099485a5..57d41be9e23 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -83,6 +83,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) { TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "CMSG_GMTICKET_CREATE possibly corrupt. Uncompression failed."); recvData.rfinish(); + delete ticket; return; } diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 92b6ddf6909..5765d64ce60 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -158,6 +158,12 @@ uint32 LootStore::LoadLootTable() continue; // error already printed to log/console. } + if (group >= 1 << 7) // it stored in 7 bit field + { + TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", GetName(), entry, item, group, 1 << 7); + return false; + } + LootStoreItem* storeitem = new LootStoreItem(item, chanceOrQuestChance, lootmode, group, mincountOrRef, maxcount); if (!storeitem->IsValid(*this, entry)) // Validity checks @@ -293,12 +299,6 @@ bool LootStoreItem::Roll(bool rate) const // Checks correctness of values bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const { - if (group >= 1 << 7) // it stored in 7 bit field - { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7); - return false; - } - if (mincountOrRef == 0) { TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index b28873d2e4d..d59f475f300 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -672,6 +672,8 @@ void Map::ProcessRelocationNotifies(const uint32 diff) void Map::RemovePlayerFromMap(Player* player, bool remove) { + sScriptMgr->OnPlayerLeaveMap(this, player); + player->RemoveFromWorld(); SendRemoveTransports(player); @@ -682,11 +684,7 @@ void Map::RemovePlayerFromMap(Player* player, bool remove) ASSERT(remove); //maybe deleted in logoutplayer when player is not in a map if (remove) - { DeleteFromWorld(player); - - sScriptMgr->OnPlayerLeaveMap(this, player); - } } template diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 09da8885076..53c5da30936 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -588,7 +588,7 @@ void AuraEffect::CalculateSpellMod() m_spellmod->op = SpellModOp(GetMiscValue()); ASSERT(m_spellmod->op < MAX_SPELLMOD); - m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types + m_spellmod->type = SpellModType(uint32(GetAuraType())); // SpellModType value == spell aura types m_spellmod->spellId = GetId(); m_spellmod->mask = GetSpellInfo()->Effects[GetEffIndex()].SpellClassMask; m_spellmod->charges = GetBase()->GetCharges(); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index e96156d85b5..db6263a8062 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5695,7 +5695,7 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex) if ((player->GetRuneCooldown(l) && player->GetCurrentRune(l) == RuneType(m_spellInfo->Effects[effIndex].MiscValueB)) && (player->GetRuneCooldown(l+1) && player->GetCurrentRune(l+1) == RuneType(m_spellInfo->Effects[effIndex].MiscValueB))) { // Should always update the rune with the lowest cd - if (player->GetRuneCooldown(l) >= player->GetRuneCooldown(l+1)) + if (l + 1 < MAX_RUNES && player->GetRuneCooldown(l) >= player->GetRuneCooldown(l+1)) l++; player->SetRuneCooldown(l, 0); --count; diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp index 604218c2e68..667815ce16c 100644 --- a/src/server/scripts/Commands/cs_rbac.cpp +++ b/src/server/scripts/Commands/cs_rbac.cpp @@ -32,6 +32,12 @@ EndScriptData */ struct RBACCommandData { RBACCommandData(): id(0), realmId(0), rbac(NULL), needDelete(false) { } + ~RBACCommandData() + { + if (needDelete) + delete rbac; + } + uint32 id; int32 realmId; RBACData* rbac; @@ -230,8 +236,7 @@ public: break; } - if (command->needDelete) - delete command; + delete command; return true; } @@ -266,8 +271,7 @@ public: break; } - if (command->needDelete) - delete command; + delete command; return true; } @@ -295,8 +299,7 @@ public: } } - if (command->needDelete) - delete command; + delete command; return true; } @@ -335,8 +338,7 @@ public: break; } - if (command->needDelete) - delete command; + delete command; return true; } @@ -375,8 +377,7 @@ public: break; } - if (command->needDelete) - delete command; + delete command; return true; } @@ -411,8 +412,7 @@ public: break; } - if (command->needDelete) - delete command; + delete command; return true; } @@ -453,8 +453,7 @@ public: } } - if (command->needDelete) - delete command; + delete command; return true; } @@ -493,8 +492,7 @@ public: break; } - if (command->needDelete) - delete command; + delete command; return true; } @@ -533,8 +531,7 @@ public: break; } - if (command->needDelete) - delete command; + delete command; return true; } @@ -569,8 +566,7 @@ public: break; } - if (command->needDelete) - delete command; + delete command; return true; } @@ -613,8 +609,7 @@ public: } } - if (command->needDelete) - delete command; + delete command; return true; } @@ -643,8 +638,7 @@ public: } } - if (command->needDelete) - delete command; + delete command; return true; } -- cgit v1.2.3 From 25acef257240edb7763eac043554ca7c7ac767eb Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 17 May 2013 21:11:18 -0500 Subject: * Batch of fixes for issues found by static analysis. --- src/server/game/Entities/Player/Player.cpp | 1 + src/server/game/Entities/Unit/Unit.cpp | 6 +- src/server/game/Groups/Group.cpp | 144 ++++++++++----------- src/server/game/Spells/Auras/SpellAuras.cpp | 4 + src/server/scripts/Commands/cs_account.cpp | 2 +- src/server/scripts/Commands/cs_wp.cpp | 2 +- .../BattleForMountHyjal/hyjal_trash.cpp | 2 +- src/server/scripts/Kalimdor/zone_winterspring.cpp | 6 +- .../Northrend/Nexus/EyeOfEternity/boss_malygos.cpp | 4 +- src/server/scripts/World/npcs_special.cpp | 2 +- 10 files changed, 86 insertions(+), 87 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 83118e6ded7..b1abf028262 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4149,6 +4149,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) // learnSpell(prev_id, false); } // if ranked non-stackable spell: need activate lesser rank and update dendence state + /// No need to check for spellInfo != NULL here because if cur_active is true, then that means that the spell was already in m_spells, and only valid spells can be pushed there. else if (cur_active && !spellInfo->IsStackableWithRanks() && spellInfo->IsRanked()) { // need manually update dependence state (learn spell ignore like attempts) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3872f9154b9..5fb106b4913 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7478,7 +7478,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp case SPELLFAMILY_PALADIN: { // Infusion of Light - if (dummySpell->SpellIconID == 3021) + if (procSpell && dummySpell->SpellIconID == 3021) { // Flash of Light HoT on Flash of Light when Sacred Shield active if (procSpell->SpellFamilyFlags[0] & 0x40000000 && procSpell->SpellIconID == 242) @@ -7509,6 +7509,8 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp // Glyph of Divinity else if (dummySpell->Id == 54939) { + if (!procSpell) + return false; *handled = true; // Check if we are the target and prevent mana gain if (victim && triggeredByAura->GetCasterGUID() == victim->GetGUID()) @@ -16837,7 +16839,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a } } - if (aurApp && aurApp->GetRemoveMode()) + if (!aurApp || aurApp->GetRemoveMode()) return; if (Player* player = ToPlayer()) diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 50c50fd4b1d..c21cc9210dc 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -365,24 +365,21 @@ bool Group::AddMember(Player* player) SubGroupCounterIncrease(subGroup); - if (player) + player->SetGroupInvite(NULL); + if (player->GetGroup()) { - player->SetGroupInvite(NULL); - if (player->GetGroup()) - { - if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() - player->SetBattlegroundOrBattlefieldRaid(this, subGroup); - else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup() - player->SetOriginalGroup(this, subGroup); - } - else //if player is not in group, then call set group - player->SetGroup(this, subGroup); - - // if the same group invites the player back, cancel the homebind timer - InstanceGroupBind* bind = GetBoundInstance(player); - if (bind && bind->save->GetInstanceId() == player->GetInstanceId()) - player->m_InstanceValid = true; + if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() + player->SetBattlegroundOrBattlefieldRaid(this, subGroup); + else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup() + player->SetOriginalGroup(this, subGroup); } + else //if player is not in group, then call set group + player->SetGroup(this, subGroup); + + // if the same group invites the player back, cancel the homebind timer + InstanceGroupBind* bind = GetBoundInstance(player); + if (bind && bind->save->GetInstanceId() == player->GetInstanceId()) + player->m_InstanceValid = true; if (!isRaidGroup()) // reset targetIcons for non-raid-groups { @@ -408,89 +405,86 @@ bool Group::AddMember(Player* player) SendUpdate(); sScriptMgr->OnGroupAddMember(this, player->GetGUID()); - if (player) + if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup()) { - if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup()) - { - // reset the new member's instances, unless he is currently in one of them - // including raid/heroic instances that they are not permanently bound to! - player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, false); - player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true); + // reset the new member's instances, unless he is currently in one of them + // including raid/heroic instances that they are not permanently bound to! + player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, false); + player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true); - if (player->getLevel() >= LEVELREQUIREMENT_HEROIC) + if (player->getLevel() >= LEVELREQUIREMENT_HEROIC) + { + if (player->GetDungeonDifficulty() != GetDungeonDifficulty()) { - if (player->GetDungeonDifficulty() != GetDungeonDifficulty()) - { - player->SetDungeonDifficulty(GetDungeonDifficulty()); - player->SendDungeonDifficulty(true); - } - if (player->GetRaidDifficulty() != GetRaidDifficulty()) - { - player->SetRaidDifficulty(GetRaidDifficulty()); - player->SendRaidDifficulty(true); - } + player->SetDungeonDifficulty(GetDungeonDifficulty()); + player->SendDungeonDifficulty(true); + } + if (player->GetRaidDifficulty() != GetRaidDifficulty()) + { + player->SetRaidDifficulty(GetRaidDifficulty()); + player->SendRaidDifficulty(true); } } - player->SetGroupUpdateFlag(GROUP_UPDATE_FULL); - UpdatePlayerOutOfRange(player); + } + player->SetGroupUpdateFlag(GROUP_UPDATE_FULL); + UpdatePlayerOutOfRange(player); - // quest related GO state dependent from raid membership - if (isRaidGroup()) - player->UpdateForQuestWorldObjects(); + // quest related GO state dependent from raid membership + if (isRaidGroup()) + player->UpdateForQuestWorldObjects(); - { - // Broadcast new player group member fields to rest of the group - player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); + { + // Broadcast new player group member fields to rest of the group + player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); - UpdateData groupData; - WorldPacket groupDataPacket; + UpdateData groupData; + WorldPacket groupDataPacket; - // Broadcast group members' fields to player - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) - { - if (itr->getSource() == player) - continue; + // Broadcast group members' fields to player + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + { + if (itr->getSource() == player) + continue; - if (Player* member = itr->getSource()) + if (Player* member = itr->getSource()) + { + if (player->HaveAtClient(member)) { - if (player->HaveAtClient(member)) - { - member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); - member->BuildValuesUpdateBlockForPlayer(&groupData, player); - member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); - } + member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); + member->BuildValuesUpdateBlockForPlayer(&groupData, player); + member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); + } - if (member->HaveAtClient(player)) + if (member->HaveAtClient(player)) + { + UpdateData newData; + WorldPacket newDataPacket; + player->BuildValuesUpdateBlockForPlayer(&newData, member); + if (newData.HasData()) { - UpdateData newData; - WorldPacket newDataPacket; - player->BuildValuesUpdateBlockForPlayer(&newData, member); - if (newData.HasData()) - { - newData.BuildPacket(&newDataPacket); - member->SendDirectMessage(&newDataPacket); - } + newData.BuildPacket(&newDataPacket); + member->SendDirectMessage(&newDataPacket); } } } + } - if (groupData.HasData()) - { - groupData.BuildPacket(&groupDataPacket); - player->SendDirectMessage(&groupDataPacket); - } - - player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); + if (groupData.HasData()) + { + groupData.BuildPacket(&groupDataPacket); + player->SendDirectMessage(&groupDataPacket); } - if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING)) - m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING); + player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER); } + if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING)) + m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING); + return true; } -bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/) +bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/) { BroadcastGroupUpdate(); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 732cb50e274..e9c456c4c7b 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1600,6 +1600,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b switch (GetId()) { case 19746: + if (!caster) + break; + // Improved concentration aura - linked aura if (caster->HasAura(20254) || caster->HasAura(20255) || caster->HasAura(20256)) { @@ -1608,6 +1611,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b else target->RemoveAura(63510); } + break; case 31821: // Aura Mastery Triggered Spell Handler // If apply Concentration Aura -> trigger -> apply Aura Mastery Immunity diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 9aa68e0892c..c347648abab 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -482,7 +482,7 @@ public: char* arg3 = strtok(NULL, " "); bool isAccountNameGiven = true; - if (arg1 && !arg3) + if (!arg3) { if (!handler->getSelectedPlayer()) return false; diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index bb48e94f744..b7a89ceb325 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -796,7 +796,7 @@ public: if (show == "info") { // Check if the user did specify a visual waypoint - if (target->GetEntry() != VISUAL_WAYPOINT) + if (target && target->GetEntry() != VISUAL_WAYPOINT) { handler->PSendSysMessage(LANG_WAYPOINT_VP_SELECT); handler->SetSentErrorMessage(true); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 630c379e71e..87a09749724 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -773,7 +773,7 @@ public: void JustSummoned(Creature* summon) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true); - if (target && summon) + if (target) summon->Attack(target, false); summons.Summon(summon); } diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index 2b68c0a2cb6..c523cfba952 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -182,10 +182,8 @@ public: } if (!found) - { return; - } - + DoNextDialogueStep(); } @@ -210,7 +208,7 @@ private: void DoNextDialogueStep() { // Last Dialogue Entry done? - if (_currentEntry && !_currentEntry->TextEntry) + if (!_currentEntry || !_currentEntry->TextEntry) { _actionTimer = 0; return; diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index d861343116f..b85c24a22eb 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -754,7 +754,7 @@ public: void UpdateAI(uint32 diff) { - if (!UpdateVictim() && _phase != PHASE_NOT_STARTED && _phase != PHASE_TWO) + if (!instance || (!UpdateVictim() && _phase != PHASE_NOT_STARTED && _phase != PHASE_TWO)) return; events.Update(diff); @@ -854,7 +854,7 @@ public: } } - if (_arcaneReinforcements && instance) + if (_arcaneReinforcements) { for (uint8 rangeDisks = 0; rangeDisks < (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 5); rangeDisks++) { diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index b5f66fcc25e..56841fcdaa1 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1751,7 +1751,7 @@ public: { me->HandleEmoteCommand(emote); Unit* owner = me->GetOwner(); - if (emote != TEXT_EMOTE_KISS || owner || owner->GetTypeId() != TYPEID_PLAYER || + if (emote != TEXT_EMOTE_KISS || !owner || owner->GetTypeId() != TYPEID_PLAYER || owner->ToPlayer()->GetTeam() != player->GetTeam()) { return; -- cgit v1.2.3 From 7da33b6bce92df159ff8f2d3154f4009f3b06eae Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 19 May 2013 11:15:54 +0200 Subject: Core/Misc: Another batch of fixes for issues found by static analysis --- src/server/game/Entities/Player/Player.cpp | 6 ------ src/server/game/World/World.cpp | 2 +- src/server/scripts/Commands/cs_lookup.cpp | 22 ++-------------------- src/server/scripts/Commands/cs_misc.cpp | 12 ++++-------- src/server/scripts/Commands/cs_modify.cpp | 24 +++++++----------------- src/server/scripts/Commands/cs_npc.cpp | 2 +- 6 files changed, 15 insertions(+), 53 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b1abf028262..3c09f9983ac 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4702,12 +4702,6 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC charDelete_method = CHAR_DELETE_REMOVE; else if (CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid)) // To avoid a query, we select loaded data. If it doesn't exist, return. { - if (!nameData) - { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Cannot find CharacterNameData entry for player %u from account %u. Could not delete character.", guid, accountId); - return; - } - // Define the required variables uint32 charDelete_minLvl = sWorld->getIntConfig(nameData->m_class != CLASS_DEATH_KNIGHT ? CONFIG_CHARDELETE_MIN_LEVEL : CONFIG_CHARDELETE_HEROIC_MIN_LEVEL); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 870f749aa07..80577c3462e 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2167,7 +2167,7 @@ namespace Trinity { WorldPacket* data = new WorldPacket(); - uint32 lineLength = (line ? strlen(line) : 0) + 1; + uint32 lineLength = strlen(line) + 1; data->Initialize(SMSG_MESSAGECHAT, 100); // guess size *data << uint8(CHAT_MSG_SYSTEM); diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 2130e61cb47..b014eb895be 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -962,12 +962,7 @@ public: uint32 id = atoi((char*)args); - bool found = false; - uint32 count = 0; - uint32 maxResults = 1; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); - if (spellInfo) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id)) { int locale = handler->GetSessionDbcLocale(); std::string name = spellInfo->SpellName[locale]; @@ -977,14 +972,6 @@ public: return true; } - if (locale < TOTAL_LOCALES) - { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - bool known = target && target->HasSpell(id); bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); @@ -1028,13 +1015,8 @@ public: ss << handler->GetTrinityString(LANG_ACTIVE); handler->SendSysMessage(ss.str().c_str()); - - if (!found) - found = true; - } } - - if (!found) + else handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND); return true; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index cadaeff5262..5e4acbb2ba5 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1071,9 +1071,7 @@ public: Player* player = handler->GetSession()->GetPlayer(); uint32 zone_id = player->GetZoneId(); - WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard( - player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); - + WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team); if (graveyard) { uint32 graveyardId = graveyard->ID; @@ -1103,14 +1101,12 @@ public: { std::string team_name; - if (team == 0) - team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (team == HORDE) + if (team == HORDE) team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); else if (team == ALLIANCE) team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); - if (team == ~uint32(0)) + if (!team) handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); else handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); @@ -2144,7 +2140,7 @@ public: return true; } - uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; + uint32 school = atoi((char*)schoolStr); if (school >= MAX_SPELL_SCHOOL) return false; diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 8ef88d459e2..ff4ef587fad 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -309,24 +309,14 @@ public: if (!pfactionid) { - if (target) - { - uint32 factionid = target->getFaction(); - uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS); - uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); - uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); - handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag); - } + uint32 factionid = target->getFaction(); + uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS); + uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); + uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); + handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag); return true; } - if (!target) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - uint32 factionid = atoi(pfactionid); uint32 flag; @@ -340,7 +330,7 @@ public: uint32 npcflag; if (!pnpcflag) - npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); + npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); else npcflag = atoi(pnpcflag); @@ -348,7 +338,7 @@ public: uint32 dyflag; if (!pdyflag) - dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); + dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); else dyflag = atoi(pdyflag); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index ea387ef17be..43c9b294419 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -252,7 +252,7 @@ public: return false; } - uint32 vendor_entry = vendor ? vendor->GetEntry() : 0; + uint32 vendor_entry = vendor->GetEntry(); if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer())) { -- cgit v1.2.3 From 00c11688974fc00342a62387b6e2d682884e0721 Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 21 May 2013 08:37:28 +0200 Subject: Core/Misc: Remove trailing whitespace, compile warnings and minor cosmetic changes --- src/server/collision/Management/MMapFactory.cpp | 2 +- src/server/collision/Management/MMapManager.cpp | 8 ++-- .../game/Battlegrounds/Zones/BattlegroundAV.h | 2 +- src/server/game/Entities/Vehicle/Vehicle.cpp | 8 ++-- src/server/game/Handlers/ChatHandler.cpp | 2 +- .../TargetedMovementGenerator.cpp | 22 ++++----- src/server/game/Movement/PathGenerator.cpp | 2 +- src/server/game/Movement/Spline/MoveSplineInit.cpp | 2 +- src/server/game/Movement/Spline/Spline.h | 10 ++-- src/server/game/Movement/Waypoints/Path.h | 4 +- src/server/scripts/Commands/cs_character.cpp | 4 +- src/server/scripts/Commands/cs_list.cpp | 4 +- src/server/scripts/Commands/cs_mmaps.cpp | 12 ++--- .../EasternKingdoms/ZulGurub/boss_arlokk.cpp | 2 +- .../EasternKingdoms/ZulGurub/boss_mandokir.cpp | 2 +- src/server/scripts/Kalimdor/zone_winterspring.cpp | 10 ++-- .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 4 +- .../Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp | 54 +++++++++++----------- .../scripts/Northrend/Ulduar/Ulduar/ulduar.h | 4 +- .../UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp | 4 +- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/server/shared/Debugging/Errors.cpp | 8 ++-- src/server/shared/Debugging/Errors.h | 16 +++---- src/server/shared/Packets/ByteBuffer.h | 2 +- 24 files changed, 95 insertions(+), 95 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/collision/Management/MMapFactory.cpp b/src/server/collision/Management/MMapFactory.cpp index 7adf7fbfa66..6aa71d77ed8 100644 --- a/src/server/collision/Management/MMapFactory.cpp +++ b/src/server/collision/Management/MMapFactory.cpp @@ -25,7 +25,7 @@ namespace MMAP { // ######################## MMapFactory ######################## // our global singleton copy - MMapManager *g_MMapManager = NULL; + MMapManager* g_MMapManager = NULL; MMapManager* MMapFactory::createOrGetMMapManager() { diff --git a/src/server/collision/Management/MMapManager.cpp b/src/server/collision/Management/MMapManager.cpp index ac0a935dd39..a3f89f42443 100644 --- a/src/server/collision/Management/MMapManager.cpp +++ b/src/server/collision/Management/MMapManager.cpp @@ -109,7 +109,7 @@ namespace MMAP snprintf(fileName, pathLen, (sWorld->GetDataPath()+"mmaps/%03i%02i%02i.mmtile").c_str(), mapId, x, y); - FILE *file = fopen(fileName, "rb"); + FILE* file = fopen(fileName, "rb"); if (!file) { TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:loadMap: Could not open mmtile file '%s'", fileName); @@ -156,7 +156,7 @@ namespace MMAP { mmap->mmapLoadedTiles.insert(std::pair(packedGridPos, tileRef)); ++loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:loadMap: Loaded mmtile %03i[%02i,%02i] into %03i[%02i,%02i]", mapId, x, y, mapId, header->x, header->y); + TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:loadMap: Loaded mmtile %03i[%02i, %02i] into %03i[%02i, %02i]", mapId, x, y, mapId, header->x, header->y); return true; } else @@ -205,7 +205,7 @@ namespace MMAP { mmap->mmapLoadedTiles.erase(packedGridPos); --loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId); + TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i, %02i] from %03i", mapId, x, y, mapId); return true; } @@ -232,7 +232,7 @@ namespace MMAP else { --loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId); + TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i, %02i] from %03i", mapId, x, y, mapId); } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 7a0af0b06d7..bbe3b064c35 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1046,7 +1046,7 @@ const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = { 13326, 1216, 59, 59 }, //Seasoned Defender { 13331, 1216, 60, 60 }, //Veteran Defender { 13422, 1216, 61, 61 }, //Champion Defender - { 13358, 1216, 59, 60 }, //Stormpike Bowman /// @todo: Confirm if this is correct. Author assumpted 60,61 & 69,70, but wouldn't work here + { 13358, 1216, 59, 60 }, //Stormpike Bowman /// @todo: Confirm if this is correct. Author assumpted 60, 61 & 69, 70, but wouldn't work here { 11949, 469, 0, 0}, //not spawned with this data, but used for handlekillunit { 11948, 469, 0, 0}, //not spawned with this data, but used for handlekillunit { 12053, 1214, 58, 58 }, //Frostwolf Guardian diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index fd5183753e1..d3c2a16c592 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -418,7 +418,7 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ * @author Machiavelli * @date 17-2-2013 * - * @param [in,out] The prospective passenger. + * @param [in, out] The prospective passenger. * @param seatId Identifier for the seat. Value of -1 indicates the next available seat. * * @return true if it succeeds, false if it fails. @@ -493,7 +493,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) * @author Machiavelli * @date 17-2-2013 * - * @param [in,out] unit The passenger to remove. + * @param [in, out] unit The passenger to remove. */ void Vehicle::RemovePassenger(Unit* unit) @@ -616,7 +616,7 @@ void Vehicle::InitMovementInfoForBase() * @author Machiavelli * @date 17-2-2013 * - * @param [in,out] The passenger for which we check the seat info. + * @param [in, out] The passenger for which we check the seat info. * * @return null if passenger not found on vehicle, else the DBC record for the seat. */ @@ -638,7 +638,7 @@ VehicleSeatEntry const* Vehicle::GetSeatForPassenger(Unit const* passenger) cons * @author Machiavelli * @date 17-2-2013 * - * @param [in,out] passenger Passenger to look up. + * @param [in, out] passenger Passenger to look up. * * @return The seat iterator for specified passenger if it's found on the vehicle. Otherwise Seats.end() (invalid iterator). */ diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 68f00a28cf1..9d4eae0f1b0 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -289,7 +289,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) // If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to // We also do that if a player is under the required level for whispers. - if (receiver->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ) || + if (receiver->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ) || (HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))) sender->AddWhisperWhiteList(receiver->GetGUID()); diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index abb4ac9964b..8086e60c912 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -27,7 +27,7 @@ #include "Player.h" template -void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool updateDestination) +void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool updateDestination) { if (!i_target.isValid() || !i_target->IsInWorld()) return; @@ -117,7 +117,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool upd } template -bool TargetedMovementGeneratorMedium::DoUpdate(T* owner, uint32 time_diff) +bool TargetedMovementGeneratorMedium::DoUpdate(T* owner, uint32 time_diff) { if (!i_target.isValid() || !i_target->IsInWorld()) return false; @@ -185,7 +185,7 @@ template void ChaseMovementGenerator::_reachTarget(T* owner) { if (owner->IsWithinMeleeRange(this->i_target.getTarget())) - owner->Attack(this->i_target.getTarget(),true); + owner->Attack(this->i_target.getTarget(), true); } template<> @@ -303,14 +303,14 @@ void FollowMovementGenerator::MovementInform(Creature* unit) } //-----------------------------------------------// -template void TargetedMovementGeneratorMedium >::_setTargetLocation(Player*, bool); -template void TargetedMovementGeneratorMedium >::_setTargetLocation(Player*, bool); -template void TargetedMovementGeneratorMedium >::_setTargetLocation(Creature*, bool); -template void TargetedMovementGeneratorMedium >::_setTargetLocation(Creature*, bool); -template bool TargetedMovementGeneratorMedium >::DoUpdate(Player*, uint32); -template bool TargetedMovementGeneratorMedium >::DoUpdate(Player*, uint32); -template bool TargetedMovementGeneratorMedium >::DoUpdate(Creature*, uint32); -template bool TargetedMovementGeneratorMedium >::DoUpdate(Creature*, uint32); +template void TargetedMovementGeneratorMedium >::_setTargetLocation(Player*, bool); +template void TargetedMovementGeneratorMedium >::_setTargetLocation(Player*, bool); +template void TargetedMovementGeneratorMedium >::_setTargetLocation(Creature*, bool); +template void TargetedMovementGeneratorMedium >::_setTargetLocation(Creature*, bool); +template bool TargetedMovementGeneratorMedium >::DoUpdate(Player*, uint32); +template bool TargetedMovementGeneratorMedium >::DoUpdate(Player*, uint32); +template bool TargetedMovementGeneratorMedium >::DoUpdate(Creature*, uint32); +template bool TargetedMovementGeneratorMedium >::DoUpdate(Creature*, uint32); template void ChaseMovementGenerator::_reachTarget(Player*); template void ChaseMovementGenerator::_reachTarget(Creature*); diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 80e8f1e1f44..3fd7e7ee393 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -701,7 +701,7 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo // Find movement delta. float delta[VERTEX_SIZE]; dtVsub(delta, steerPos, iterPos); - float len = dtSqrt(dtVdot(delta,delta)); + float len = dtSqrt(dtVdot(delta, delta)); // If the steer target is end of path or off-mesh link, do not move past the location. if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE) len = 1.0f; diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index 4b1af78a799..49a33a4f79e 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -118,7 +118,7 @@ namespace Movement } PacketBuilder::WriteMonsterMove(move_spline, data); - unit->SendMessageToSet(&data,true); + unit->SendMessageToSet(&data, true); return move_spline.Duration(); } diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index 2a2f3fa8f43..42090cae71b 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -91,13 +91,13 @@ public: @param t - percent of segment length, assumes that t in range [0, 1] @param Idx - spline segment index, should be in range [first, last) */ - void evaluate_percent(index_type Idx, float u, Vector3& c) const {(this->*evaluators[m_mode])(Idx, u,c);} + void evaluate_percent(index_type Idx, float u, Vector3& c) const {(this->*evaluators[m_mode])(Idx, u, c);} /** Caclulates derivation in index Idx, and percent of segment length t @param Idx - spline segment index, should be in range [first, last) @param t - percent of spline segment length, assumes that t in range [0, 1] */ - void evaluate_derivative(index_type Idx, float u, Vector3& hermite) const {(this->*derivative_evaluators[m_mode])(Idx, u,hermite);} + void evaluate_derivative(index_type Idx, float u, Vector3& hermite) const {(this->*derivative_evaluators[m_mode])(Idx, u, hermite);} /** Bounds for spline indexes. All indexes should be in range [first, last). */ index_type first() const { return index_lo;} @@ -156,12 +156,12 @@ public: /** Calculates the position for given segment Idx, and percent of segment length t @param t = partial_segment_length / whole_segment_length @param Idx - spline segment index, should be in range [first, last). */ - void evaluate_percent(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_percent(Idx, u,c);} + void evaluate_percent(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_percent(Idx, u, c);} /** Caclulates derivation for index Idx, and percent of segment length t @param Idx - spline segment index, should be in range [first, last) @param t - percent of spline segment length, assumes that t in range [0, 1]. */ - void evaluate_derivative(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_derivative(Idx, u,c);} + void evaluate_derivative(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_derivative(Idx, u, c);} // Assumes that t in range [0, 1] index_type computeIndexInBounds(float t) const; @@ -169,7 +169,7 @@ public: /** Initializes spline. Don't call other methods while spline not initialized. */ void init_spline(const Vector3 * controls, index_type count, EvaluationMode m) { SplineBase::init_spline(controls, count, m);} - void init_cyclic_spline(const Vector3 * controls, index_type count, EvaluationMode m, index_type cyclic_point) { SplineBase::init_cyclic_spline(controls, count, m,cyclic_point);} + void init_cyclic_spline(const Vector3 * controls, index_type count, EvaluationMode m, index_type cyclic_point) { SplineBase::init_cyclic_spline(controls, count, m, cyclic_point);} /** Initializes lengths with SplineBase::SegLength method. */ void initLengths(); diff --git a/src/server/game/Movement/Waypoints/Path.h b/src/server/game/Movement/Waypoints/Path.h index 39f05184cf6..9814d1c65e1 100644 --- a/src/server/game/Movement/Waypoints/Path.h +++ b/src/server/game/Movement/Waypoints/Path.h @@ -40,13 +40,13 @@ class Path void erase(uint32 idx) { i_nodes.erase(i_nodes.begin()+idx); } void crop(unsigned int start, unsigned int end) { - while(start && !i_nodes.empty()) + while (start && !i_nodes.empty()) { i_nodes.pop_front(); --start; } - while(end && !i_nodes.empty()) + while (end && !i_nodes.empty()) { i_nodes.pop_back(); --end; diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index fdcf88177a9..e51052bc18f 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -320,7 +320,7 @@ public: // check online security if (handler->HasLowerSecurity(target, 0)) return false; - + playerOldName = target->GetName(); } else @@ -345,7 +345,7 @@ public: handler->SetSentErrorMessage(true); return false; } - + if (WorldSession* session = handler->GetSession()) { if (!session->HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(newName)) diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 81608ebd458..6b8ce7732c5 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -518,7 +518,7 @@ public: uint32 copp = (money % GOLD) % SILVER; std::string receiverStr = handler->playerLink(receiver); std::string senderStr = handler->playerLink(sender); - handler->PSendSysMessage(LANG_LIST_MAIL_INFO_1 , messageId, subject.c_str(),gold, silv, copp); + handler->PSendSysMessage(LANG_LIST_MAIL_INFO_1, messageId, subject.c_str(), gold, silv, copp); handler->PSendSysMessage(LANG_LIST_MAIL_INFO_2, senderStr.c_str(), senderId, receiverStr.c_str(), receiverId); handler->PSendSysMessage(LANG_LIST_MAIL_INFO_3, TimeToTimestampStr(deliverTime).c_str(), TimeToTimestampStr(expireTime).c_str()); if (hasItem == 1) @@ -541,7 +541,7 @@ public: uint32 item_entry = fields[0].GetUInt32(); uint32 item_count = fields[1].GetUInt32(); QueryResult result4; - result4 = WorldDatabase.PQuery("SELECT name,quality FROM item_template WHERE entry = '%u'", item_entry); + result4 = WorldDatabase.PQuery("SELECT name, quality FROM item_template WHERE entry = '%u'", item_entry); Field* fields1 = result4->Fetch(); std::string item_name = fields1[0].GetString(); int item_quality = fields1[1].GetUInt8(); diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 55b6edbadbe..300b39fc389 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -128,7 +128,7 @@ public: int32 gy = 32 - player->GetPositionY() / SIZE_OF_GRIDS; handler->PSendSysMessage("%03u%02i%02i.mmtile", player->GetMapId(), gy, gx); - handler->PSendSysMessage("gridloc [%i,%i]", gx, gy); + handler->PSendSysMessage("gridloc [%i, %i]", gx, gy); // calculate navmesh tile location dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()); @@ -148,7 +148,7 @@ public: int32 tilex = int32((y - min[0]) / SIZE_OF_GRIDS); int32 tiley = int32((x - min[2]) / SIZE_OF_GRIDS); - handler->PSendSysMessage("Calc [%02i,%02i]", tilex, tiley); + handler->PSendSysMessage("Calc [%02i, %02i]", tilex, tiley); // navmesh poly -> navmesh tile location dtQueryFilter filter = dtQueryFilter(); @@ -156,16 +156,16 @@ public: navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, NULL); if (polyRef == INVALID_POLYREF) - handler->PSendSysMessage("Dt [??,??] (invalid poly, probably no tile loaded)"); + handler->PSendSysMessage("Dt [??, ??] (invalid poly, probably no tile loaded)"); else { dtMeshTile const* tile; dtPoly const* poly; navmesh->getTileAndPolyByRef(polyRef, &tile, &poly); if (tile) - handler->PSendSysMessage("Dt [%02i,%02i]", tile->header->x, tile->header->y); + handler->PSendSysMessage("Dt [%02i, %02i]", tile->header->x, tile->header->y); else - handler->PSendSysMessage("Dt [??,??] (no tile loaded)"); + handler->PSendSysMessage("Dt [??, ??] (no tile loaded)"); } return true; @@ -190,7 +190,7 @@ public: if (!tile || !tile->header) continue; - handler->PSendSysMessage("[%02i,%02i]", tile->header->x, tile->header->y); + handler->PSendSysMessage("[%02i, %02i]", tile->header->x, tile->header->y); } return true; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 97eeb385e15..6fe0934191e 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -222,7 +222,7 @@ class boss_arlokk : public CreatureScript break; case EVENT_MARK_OF_ARLOKK: { - Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1,3), 0.0f, false, -SPELL_MARK_OF_ARLOKK); + Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1, 3), 0.0f, false, -SPELL_MARK_OF_ARLOKK); if (!target) target = me->getVictim(); if (target) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index bd7b7a8798c..9a94ab02348 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -409,7 +409,7 @@ class spell_threatening_gaze : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - if(Unit* target = GetTarget()) + if (Unit* target = GetTarget()) if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH) caster->CastSpell(target, SPELL_WATCH_CHARGE); } diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index c523cfba952..6458047bb60 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -154,14 +154,14 @@ struct DialogueEntry class DialogueHelper { public: - // The array MUST be terminated by {0,0,0} + // The array MUST be terminated by {0, 0, 0} DialogueHelper(DialogueEntry const* dialogueArray) : _dialogueArray(dialogueArray), _currentEntry(NULL), _actionTimer(0), _isFirstSide(true) {} - // The array MUST be terminated by {0,0,0,0,0} + // The array MUST be terminated by {0, 0, 0, 0, 0} /// Function to initialize the dialogue helper for instances. If not used with instances, GetSpeakerByEntry MUST be overwritten to obtain the speakers /// Set if take first entries or second entries @@ -183,7 +183,7 @@ public: if (!found) return; - + DoNextDialogueStep(); } @@ -398,7 +398,7 @@ public: void WaypointReached(uint32 pointId) { - switch(pointId) + switch (pointId) { case 3: Talk(SAY_ENTER_OWL_THICKET); @@ -437,7 +437,7 @@ public: SetEscortPaused(true); DoSummonPriestess(); Talk(SAY_RANSHALLA_ALTAR_2); - events.ScheduleEvent(EVENT_RESUME,2000); + events.ScheduleEvent(EVENT_RESUME, 2000); break; case 44: // Stop the escort and turn towards the altar diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index bd8afded346..090ebbca69d 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -148,10 +148,10 @@ class npc_announcer_toc10 : public CreatureScript break; } } - + if (i >= NUM_MESSAGES) return false; - + player->SEND_GOSSIP_MENU(_GossipMessage[i].msgnum, creature->GetGUID()); return true; } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index 4b2961d2616..105b4757066 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -95,7 +95,7 @@ enum Yells SAY_STORMWIND_ROLEPLAY_2 = 1, SAY_STORMWIND_ROLEPLAY_3 = 2, SAY_STORMWIND_ROLEPLAY_6 = 3, - + // King Llane SAY_STORMWIND_ROLEPLAY_5 = 0, }; @@ -440,7 +440,7 @@ class boss_voice_of_yogg_saron : public CreatureScript void EnterEvadeMode() { BossAI::EnterEvadeMode(); - + for (uint8 i = DATA_SARA; i <= DATA_MIMIRON_YS; ++i) if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) creature->AI()->EnterEvadeMode(); @@ -448,7 +448,7 @@ class boss_voice_of_yogg_saron : public CreatureScript // not sure, spoken by Sara (sound), regarding to wowwiki Voice whispers it Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player *player = itr->getSource()) + if (Player* player = itr->getSource()) { if (events.IsInPhase(PHASE_ONE)) Talk(WHISPER_VOICE_PHASE_1_WIPE, player->GetGUID()); @@ -670,16 +670,16 @@ class boss_sara : public CreatureScript std::map::const_iterator itr = _linkData.find(guid); if (itr != _linkData.end()) return itr->second; - + return 0; } - + void SetLinkBetween(uint64 player1, uint64 player2) { _linkData[player1] = player2; _linkData[player2] = player1; } - + // called once for each target on aura remove void RemoveLinkFrom(uint64 player1) { @@ -932,7 +932,7 @@ class boss_yogg_saron : public CreatureScript Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player *player = itr->getSource()) + if (Player* player = itr->getSource()) { player->RemoveAurasDueToSpell(SPELL_SANITY); player->RemoveAurasDueToSpell(SPELL_INSANE); @@ -1069,7 +1069,7 @@ class boss_brain_of_yogg_saron : public CreatureScript uint8 illusion = _instance->GetData(DATA_ILLUSION); if (++_tentaclesKilled >= (illusion == ICECROWN_ILLUSION ? 9 : 8)) { - sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA); + sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA); _summons.DespawnAll(); DoCastAOE(SPELL_SHATTERED_ILLUSION, true); _instance->HandleGameObject(_instance->GetData64(GO_BRAIN_ROOM_DOOR_1 + illusion), true); @@ -1522,7 +1522,7 @@ class npc_observation_ring_keeper : public CreatureScript DoCast(SPELL_TELEPORT); Talk(SAY_KEEPER_CHOSEN_1, player->GetGUID()); Talk(SAY_KEEPER_CHOSEN_2, player->GetGUID()); - + switch (me->GetEntry()) { case NPC_FREYA_OBSERVATION_RING: @@ -2085,16 +2085,16 @@ class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader // 63830 return new spell_yogg_saron_malady_of_the_mind_AuraScript(); } }; - + class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 { public: spell_yogg_saron_brain_link() : SpellScriptLoader("spell_yogg_saron_brain_link") { } - + class spell_yogg_saron_brain_link_SpellScript : public SpellScript { PrepareSpellScript(spell_yogg_saron_brain_link_SpellScript); - + void FilterTargets(std::list& targets) { targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_ILLUSION_ROOM)); @@ -2104,17 +2104,17 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 targets.clear(); return; } - + if (SaraAI* ai = CAST_AI(SaraAI, GetCaster()->GetAI())) ai->SetLinkBetween(targets.front()->GetGUID(), targets.back()->GetGUID()); } - + void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_brain_link_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; - + class spell_yogg_saron_brain_link_AuraScript : public AuraScript { PrepareAuraScript(spell_yogg_saron_brain_link_AuraScript); @@ -2127,13 +2127,13 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 return false; return true; } - + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* caster = GetCaster(); if (!caster) return; - + if (SaraAI* ai = CAST_AI(SaraAI, caster->GetAI())) { if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) @@ -2148,36 +2148,36 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 } } } - + void DummyTick(AuraEffect const* aurEff) { Unit* caster = GetCaster(); if (!caster) return; - + SaraAI* ai = CAST_AI(SaraAI, caster->GetAI()); if (!ai) return; - + Player* linked = ObjectAccessor::GetPlayer(*GetTarget(), ai->GetLinkedPlayerGUID(GetTarget()->GetGUID())); if (!linked) return; - + GetTarget()->CastSpell(linked, (GetTarget()->GetDistance(linked) > (float)aurEff->GetAmount()) ? SPELL_BRAIN_LINK_DAMAGE : SPELL_BRAIN_LINK_NO_DAMAGE, true); } - + void Register() { OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_brain_link_AuraScript::DummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); OnEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_brain_link_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; - + SpellScript* GetSpellScript() const { return new spell_yogg_saron_brain_link_SpellScript(); } - + AuraScript* GetAuraScript() const { return new spell_yogg_saron_brain_link_AuraScript(); @@ -2212,7 +2212,7 @@ class spell_yogg_saron_boil_ominously : public SpellScriptLoader // 63030 { public: spell_yogg_saron_boil_ominously() : SpellScriptLoader("spell_yogg_saron_boil_ominously") { } - + class spell_yogg_saron_boil_ominously_SpellScript : public SpellScript { PrepareSpellScript(spell_yogg_saron_boil_ominously_SpellScript); @@ -2223,7 +2223,7 @@ class spell_yogg_saron_boil_ominously : public SpellScriptLoader // 63030 return false; return true; } - + void HandleDummy(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) @@ -2235,7 +2235,7 @@ class spell_yogg_saron_boil_ominously : public SpellScriptLoader // 63030 GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_GUARDIAN_1, true); } } - + void Register() { OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_boil_ominously_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index 86c0c4888ed..612be3b71e8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -21,7 +21,7 @@ #include "ObjectMgr.h" #define UlduarScriptName "instance_ulduar" -extern Position const ObservationRingKeepersPos[4]; +extern Position const ObservationRingKeepersPos[4]; extern Position const YSKeepersPos[4]; extern Position const AlgalonLandPos; @@ -149,7 +149,7 @@ enum UlduarNPCs NPC_SANITY_WELL = 33991, NPC_DESCEND_INTO_MADNESS = 34072, NPC_MARKED_IMMORTAL_GUARDIAN = 36064, - + // Algalon the Observer NPC_BRANN_BRONZBEARD_ALG = 34064, NPC_AZEROTH = 34246, diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index 84829cdae12..8e726c10fca 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -115,10 +115,10 @@ public: /// There is a good reason to store them like this, we are going to shuffle the order. for (uint32 i = PHASE_FRENZIED_WORGEN; i < PHASE_GORTOK_PALEHOOF; ++i) Sequence[i] = Phase(i); - + /// This ensures a random order and only executes each phase once. std::random_shuffle(Sequence, Sequence + PHASE_GORTOK_PALEHOOF); - + uiArcingSmashTimer = 15000; uiImpaleTimer = 12000; uiWhiteringRoarTimer = 10000; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 60f641d9054..c60f4f07821 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3531,7 +3531,7 @@ class spell_gen_orc_disguise : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || + if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE)) return false; return true; diff --git a/src/server/shared/Debugging/Errors.cpp b/src/server/shared/Debugging/Errors.cpp index 877d7554c43..1bfe8c8e949 100644 --- a/src/server/shared/Debugging/Errors.cpp +++ b/src/server/shared/Debugging/Errors.cpp @@ -24,7 +24,7 @@ namespace Trinity { -void Assert(char const *file, int line, char const *function, char const *message) +void Assert(char const* file, int line, char const* function, char const* message) { ACE_Stack_Trace st; fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", @@ -33,7 +33,7 @@ void Assert(char const *file, int line, char const *function, char const *messag exit(1); } -void Fatal(char const *file, int line, char const *function, char const *message) +void Fatal(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s FATAL ERROR:\n %s\n", file, line, function, message); @@ -42,7 +42,7 @@ void Fatal(char const *file, int line, char const *function, char const *message exit(1); } -void Error(char const *file, int line, char const *function, char const *message) +void Error(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s ERROR:\n %s\n", file, line, function, message); @@ -50,7 +50,7 @@ void Error(char const *file, int line, char const *function, char const *message exit(1); } -void Warning(char const *file, int line, char const *function, char const *message) +void Warning(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s WARNING:\n %s\n", file, line, function, message); diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h index fa526a4d094..2821ca504e7 100644 --- a/src/server/shared/Debugging/Errors.h +++ b/src/server/shared/Debugging/Errors.h @@ -24,20 +24,20 @@ namespace Trinity { - DECLSPEC_NORETURN void Assert(char const *file, int line, char const *function, char const *message) ATTR_NORETURN; + DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; - DECLSPEC_NORETURN void Fatal(char const *file, int line, char const *function, char const *message) ATTR_NORETURN; + DECLSPEC_NORETURN void Fatal(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; - DECLSPEC_NORETURN void Error(char const *file, int line, char const *function, char const *message) ATTR_NORETURN; + DECLSPEC_NORETURN void Error(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; - void Warning(char const *file, int line, char const *function, char const *message); + void Warning(char const* file, int line, char const* function, char const* message); } // namespace Trinity -#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while(0) -#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) -#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) -#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) +#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while (0) +#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) +#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) +#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) #define ASSERT WPAssert diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 302a03dee47..7777842af17 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -37,7 +37,7 @@ class ByteBufferException : public std::exception public: ~ByteBufferException() throw() { } - char const * what() const throw() { return msg_.c_str(); } + char const* what() const throw() { return msg_.c_str(); } protected: std::string & message() throw() { return msg_; } -- cgit v1.2.3