diff options
author | maximius <none@none> | 2009-09-18 14:10:37 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-09-18 14:10:37 -0700 |
commit | 333f1c9d729e99c86b9747aa95336010589d564d (patch) | |
tree | c93e94781a126a8ad7a62e846df04adb7c913905 /src | |
parent | 0d9d400e794f6bcd2f706a4fb238b6428ad00862 (diff) |
*[8475] fixed some gcc-warnings Author: balrok
*[8476] Revert some recent cleanup changes, some other fixes and cleanups. Author: VladimirMangos
*[8489] Fixed player visibility update in case view point different from player itself. Author: SilverIce
*[8493] Avoid unexpected multiply error messages at wrong `quest_template`.`RewSpell*` Author: VladimirMangos
*[8496] Resolve some #include cycles and unsafe code.
* Common.h -> Threading.h -> Errors.h -> Common.h
* Remove reduncdent #include "ByteBuffer.h" in headers
* Remove redundent #include "Auth/BigNumber.h" in headers
* Avoid multyply data copy at use some now dropped functions in BigNumber.
* Avoid copy fixed byte count from byte arrays with unknown real size created from BigNumber.
* Avoid possible problems for build mangos at different platform or compilers. Author: VladimirMangos.
*[8501] Apply code style and cleanups to some Player functions. Author: VladimirMangos.
*[8502] Disable quests related to specific game events at startup if event not active. Also rename member boolean variable. Author: NoFantasy
*[8506] Add check for IsAutoComplete() in SendPreparedQuest().
For cases where quest is repeatable but has Method!=0, QuestDetails must be sent instead of RequestItems.
Some additional code cleanup. Author: NoFantasy
*[8507] Check amount of spawned pools before decrement to avoid unexpected result. Also rename variable to more meaningful name. Signed-off-by: NoFantasy <nofantasy@nf.no>
Thanks to Stryker and onkelz28!
--HG--
branch : trunk
Diffstat (limited to 'src')
46 files changed, 202 insertions, 217 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 8ac19588b7c..e11728b32d3 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1906,5 +1906,6 @@ WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard( Player* player ) bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const { BattleGroundTeamId team_idx = GetTeamIndexByTeamId(team); - return m_TeamScores[team_idx] >= minScore && m_TeamScores[team_idx] <= maxScore; + uint32 score = (m_TeamScores[team_idx] < 0) ? 0 : uint32(m_TeamScores[team_idx]); + return score >= minScore && score <= maxScore; } diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index a6e9e9b97d7..adf480d6f97 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -689,8 +689,8 @@ bool BattleGroundAB::IsAllNodesConrolledByTeam(uint32 team) const { uint32 count = 0; for(int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) - if (team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED || - team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) + if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) || + (team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)) ++count; return count == BG_AB_DYNAMIC_NODES_COUNT; diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index dbf68dc1d31..c16de449f54 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -149,8 +149,8 @@ class BGQueueInviteEvent : public BasicEvent private: uint64 m_PlayerGuid; uint32 m_BgInstanceGUID; - uint32 m_RemoveTime; BattleGroundTypeId m_BgTypeId; + uint32 m_RemoveTime; }; /* diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index c65c923a31e..58c7a70caea 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -1333,7 +1333,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) uint8 srcbag, srcslot; recv_data >> srcbag >> srcslot; - sLog.outDebug("Item " I64FMT ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); + sLog.outDebug("Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); Item *item = _player->GetItemByGuid(itemGuid); diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 068d524b9ad..34a1df42e0a 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1274,7 +1274,7 @@ valid examples: char c = reader.peek(); // ignore enchants etc. - while(c >='0' && c <='9' || c==':') + while((c >='0' && c <='9') || c==':') { reader.ignore(1); c = reader.peek(); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index a04ec449fbd..e04a552c335 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -247,7 +247,7 @@ void Creature::SearchFormationAndPath() void Creature::RemoveCorpse() { - if( getDeathState()!=CORPSE && !m_isDeadByDefault || getDeathState()!=ALIVE && m_isDeadByDefault ) + if ((getDeathState()!=CORPSE && !m_isDeadByDefault) || (getDeathState()!=ALIVE && m_isDeadByDefault)) return; m_deathTimer = 0; @@ -1736,10 +1736,10 @@ float Creature::GetAttackDistance(Unit const* pl) const if(aggroRate==0) return 0.0f; - int32 playerlevel = pl->getLevelForTarget(this); - int32 creaturelevel = getLevelForTarget(pl); + uint32 playerlevel = pl->getLevelForTarget(this); + uint32 creaturelevel = getLevelForTarget(pl); - int32 leveldif = playerlevel - creaturelevel; + int32 leveldif = int32(playerlevel) - int32(creaturelevel); // "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob." if ( leveldif < - 25) @@ -2027,7 +2027,7 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const { if( GetEntry() == VISUAL_WAYPOINT && !pl->isGameMaster() ) return false; - return isAlive() || m_deathTimer > 0 || m_isDeadByDefault && m_deathState==CORPSE; + return (isAlive() || m_deathTimer > 0 || (m_isDeadByDefault && m_deathState==CORPSE)); } // Dead player see live creatures near own corpse diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index b7795dc3927..bf606c6c488 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -381,7 +381,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 target = owner; } } - else if (target = m_creature->getVictim()) + else if ((target = m_creature->getVictim())) { if (target->GetTypeId() != TYPEID_PLAYER) if (Unit* owner = target->GetOwner()) diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index c60ec02bab9..e92fcb70863 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -402,6 +402,7 @@ void GameObject::Update(uint32 /*p_time*/) if (GetGOInfo()->GetAutoCloseTime() && (m_cooldownTime < time(NULL))) ResetDoorOrButton(); break; + default: break; } break; } diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index e11e1210ff5..d66b595dce8 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -22,7 +22,6 @@ #define TRINITY_GRIDNOTIFIERS_H #include "ObjectGridLoader.h" -#include "ByteBuffer.h" #include "UpdateData.h" #include <iostream> @@ -1224,7 +1223,7 @@ namespace Trinity ~LocalizedPacketListDo() { for(size_t i = 0; i < i_data_cache.size(); ++i) - for(int j = 0; j < i_data_cache[i].size(); ++j) + for(size_t j = 0; j < i_data_cache[i].size(); ++j) delete i_data_cache[i][j]; } void operator()( Player* p ); diff --git a/src/game/Guild.h b/src/game/Guild.h index 0e70ed53fd0..a58440969ae 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -297,19 +297,21 @@ class Guild uint32 GetId(){ return m_Id; } const uint64& GetLeader(){ return m_LeaderGuid; } - std::string GetName(){ return m_Name; } - std::string GetMOTD(){ return MOTD; } - std::string GetGINFO(){ return GINFO; } - - uint32 GetCreatedYear(){ return m_CreatedYear; } - uint32 GetCreatedMonth(){ return m_CreatedMonth; } - uint32 GetCreatedDay(){ return m_CreatedDay; } - - uint32 GetEmblemStyle(){ return m_EmblemStyle; } - uint32 GetEmblemColor(){ return m_EmblemColor; } - uint32 GetBorderStyle(){ return m_BorderStyle; } - uint32 GetBorderColor(){ return m_BorderColor; } - uint32 GetBackgroundColor(){ return m_BackgroundColor; } + std::string const& GetName() const { return m_Name; } + std::string const& GetMOTD() const { return MOTD; } + std::string const& GetGINFO() const { return GINFO; } + + + uint32 GetCreatedYear() const { return m_CreatedYear; } + uint32 GetCreatedMonth() const { return m_CreatedMonth; } + uint32 GetCreatedDay() const { return m_CreatedDay; } + + + uint32 GetEmblemStyle() const { return m_EmblemStyle; } + uint32 GetEmblemColor() const { return m_EmblemColor; } + uint32 GetBorderStyle() const { return m_BorderStyle; } + uint32 GetBorderColor() const { return m_BorderColor; } + uint32 GetBackgroundColor() const { return m_BackgroundColor; } void SetLeader(uint64 guid); bool AddMember(uint64 plGuid, uint32 plRank); diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 4b163c09e85..c11ad11766b 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -1074,7 +1074,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) recv_data >> unk2; // always 0 recv_data >> SplitedAmount; - if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS || BankTabDst == BankTab && BankTabSlotDst == BankTabSlot) + if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS || (BankTabDst == BankTab && BankTabSlotDst == BankTabSlot)) { recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet return; diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index efc09494d1d..1efd3f2ce7a 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -149,7 +149,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/) // save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE); - if(save_interval==0 || save_interval > 20*IN_MILISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILISECONDS) + if ((save_interval==0 || save_interval > 20*IN_MILISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILISECONDS)) player->SaveToDB(); return true; @@ -164,7 +164,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) for(; itr != m.end(); ++itr) { AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); - if ((itr->second->isGameMaster() || itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST)) && + if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) && (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer()))) { if(first) diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 2f0579b3d1d..f9adcf1dbaf 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -2736,7 +2736,7 @@ bool ChatHandler::HandleGoTaxinodeCommand(const char* args) return false; } - if (node->x == 0.0f && node->y == 0.0f && node->z == 0.0f || + if ((node->x == 0.0f && node->y == 0.0f && node->z == 0.0f) || !MapManager::IsValidMapCoord(node->map_id,node->x,node->y,node->z)) { PSendSysMessage(LANG_INVALID_TARGET_COORD,node->x,node->y,node->map_id); @@ -2873,7 +2873,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args) float y = (float)atof(py); // prevent accept wrong numeric args - if (x==0.0f && *px!='0' || y==0.0f && *py!='0') + if ((x==0.0f && *px!='0') || (y==0.0f && *py!='0')) return false; uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId(); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 5e545fa5a41..2524e829a38 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -3669,8 +3669,7 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id) } bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) -{ - uint32 classmask = m_session->GetPlayer()->getClassMask(); +{ for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) { @@ -3713,8 +3712,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) // converting string that we try to find to lower case wstrToLower( wnamepart ); - - uint32 classmask = m_session->GetPlayer()->getClassMask(); + std::string name; diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 025a367528c..b14710c5191 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -5438,7 +5438,7 @@ bool ChatHandler::HandleServerRestartCommand(const char* args) int32 time = atoi (time_str); ///- Prevent interpret wrong arg value as 0 secs shutdown time - if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) + if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0)) return false; if (exitcode_str) @@ -5473,7 +5473,7 @@ bool ChatHandler::HandleServerIdleRestartCommand(const char* args) int32 time = atoi (time_str); ///- Prevent interpret wrong arg value as 0 secs shutdown time - if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) + if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0)) return false; if (exitcode_str) @@ -7068,7 +7068,7 @@ bool ChatHandler::HandleSendItemsCommand(const char* args) } uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1; - if(item_count < 1 || item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount)) + if (item_count < 1 || (item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount))) { PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count,item_id); SetSentErrorMessage(true); diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 7a7f78fb90a..e4ee8bffc6f 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -47,7 +47,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) GameObject *go = player->GetMap()->GetGameObject(lguid); // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO - if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) + if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))) { player->SendLootRelease(lguid); return; @@ -175,7 +175,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) GameObject *pGameObject = GetPlayer()->GetMap()->GetGameObject(guid); // not check distance for GO in case owned GO (fishing bobber case, for example) - if( pGameObject && (pGameObject->GetOwnerGUID()==_player->GetGUID() || pGameObject->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) ) + if (pGameObject && ((pGameObject->GetOwnerGUID()==_player->GetGUID() || pGameObject->IsWithinDistInMap(_player,INTERACTION_DISTANCE)))) pLoot = &pGameObject->loot; break; @@ -292,7 +292,7 @@ void WorldSession::DoLootRelease( uint64 lguid ) GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid); // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO - if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) + if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))) return; loot = &go->loot; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 390efda1002..6b51fb80d4d 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1870,7 +1870,8 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const // Makers' Overlook (ground and cave) else if (x > 5634.48f && x < 5774.53f && y < 3475.0f && z > 300.0f) { - if(y > 3380.26f || y > 3265.0f && z < 360.0f) areaflag = 2187; + if(y > 3380.26f || (y > 3265.0f && z < 360.0f)) + areaflag = 2187; } break; // The Makers' Perch (underground) @@ -1949,7 +1950,7 @@ void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 area bool Map::IsInWater(float x, float y, float pZ, float min_depth) const { // Check surface in x, y point for liquid - if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) + if (const_cast<Map*>(this)->GetGrid(x, y)) { LiquidData liquid_status; if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, &liquid_status)) @@ -1963,7 +1964,7 @@ bool Map::IsInWater(float x, float y, float pZ, float min_depth) const bool Map::IsUnderWater(float x, float y, float z) const { - if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) + if (const_cast<Map*>(this)->GetGrid(x, y)) { if (getLiquidStatus(x, y, z, MAP_LIQUID_TYPE_WATER|MAP_LIQUID_TYPE_OCEAN)&LIQUID_MAP_UNDER_WATER) return true; diff --git a/src/game/Map.h b/src/game/Map.h index c9484e78101..cc411300f15 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -506,6 +506,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj private: + time_t i_gridExpiry; + //used for fast base_map (e.g. MapInstanced class object) search for //InstanceMaps and BattleGroundMaps... Map* m_parentMap; @@ -517,7 +519,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj GridMap *GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]; std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells; - time_t i_gridExpiry; IntervalTimer m_notifyTimer; bool i_notifyLock, i_scriptLock; diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index d77bd83ede2..0c6aa44ad1d 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -95,7 +95,7 @@ MotionMaster::UpdateMotion(uint32 diff) if (m_expList) { - for (int i = 0; i < m_expList->size(); ++i) + for (size_t i = 0; i < m_expList->size(); ++i) { MovementGenerator* mg = (*m_expList)[i]; DirectDelete(mg); diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 40be00327f5..e3cc490adb4 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -485,7 +485,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data) } else { - sLog.outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " I64FMT " and should be " I64FMT, guid, _player->m_mover->GetGUID()); + sLog.outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " and should be " UI64FMTD, guid, _player->m_mover->GetGUID()); GetPlayer()->SetMover(GetPlayer()); } } diff --git a/src/game/Object.h b/src/game/Object.h index a2c8125b669..7e899f76d4a 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -22,7 +22,6 @@ #define _OBJECT_H #include "Common.h" -#include "ByteBuffer.h" #include "UpdateFields.h" #include "UpdateData.h" #include "GameSystem/GridReference.h" diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index aab742aed65..8bc0e385f6f 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -480,12 +480,22 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj) /*void ObjectAccessor::UpdateVisibilityForPlayer( Player* player ) { + WorldObject const* viewPoint = player->GetViewPoint(); + Map* m = player->GetMap(); + CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); Cell cell(p); - Map* m = player->GetMap(); m->UpdatePlayerVisibility(player, cell, p); - m->UpdateObjectsVisibilityFor(player, cell, p); + if (player!=viewPoint) + { + CellPair pView(Trinity::ComputeCellPair(viewPoint->GetPositionX(), viewPoint->GetPositionY())); + Cell cellView(pView); + + m->UpdateObjectsVisibilityFor(player, cellView, pView); + } + else + m->UpdateObjectsVisibilityFor(player, cell, p); }*/ /// Define the static member of HashMapHolder diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 5db7dd274bc..655b44b98f2 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -27,7 +27,6 @@ #include "Utilities/UnorderedMap.h" #include "Policies/ThreadingModel.h" -#include "ByteBuffer.h" #include "UpdateData.h" #include "GridDefines.h" diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 2f4bad688ef..f44c9747ca1 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -115,7 +115,7 @@ bool SpellClickInfo::IsFitToRequirements(Player const* player, Creature const * if(questStart) { // not in expected required quest state - if(!player || (!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)) + if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart))) return false; } @@ -878,8 +878,8 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* // replace by new structures array const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()/2+1]; - int i=0; - for(uint32 j=0;j<val.size()/2;++j) + uint32 i=0; + for(uint32 j = 0; j < val.size()/2;++j) { CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]); cAura.spell_id = (uint32)val[2*j+0]; @@ -1301,7 +1301,7 @@ void ObjectMgr::LoadCreatures() if(heroicCreatures.find(data.id)!=heroicCreatures.end()) { - sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template in `creature_template_substitution`, skipped.",guid,data.id ); + sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template (entry: %u) in `creature_template_substitution`, skipped.",guid,data.id ); continue; } @@ -3823,8 +3823,8 @@ void ObjectMgr::LoadQuests() bool found = false; for(uint8 k = 0; k < 3; ++k) { - if( spellInfo->Effect[k]==SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k])==qinfo->QuestId || - spellInfo->Effect[k]==SPELL_EFFECT_SEND_EVENT) + if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) || + spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT) { found = true; break; @@ -3980,19 +3980,18 @@ void ObjectMgr::LoadQuests() qinfo->RewSpell = 0; // no spell reward will display for this quest } - if(!SpellMgr::IsSpellValid(spellInfo)) + else if(!SpellMgr::IsSpellValid(spellInfo)) { sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell); qinfo->RewSpell = 0; // no spell reward will display for this quest } - if(GetTalentSpellCost(qinfo->RewSpell)) + else if(GetTalentSpellCost(qinfo->RewSpell)) { sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell); qinfo->RewSpell = 0; // no spell reward will display for this quest - continue; } } @@ -4007,19 +4006,18 @@ void ObjectMgr::LoadQuests() qinfo->RewSpellCast = 0; // no spell will be casted on player } - if(!SpellMgr::IsSpellValid(spellInfo)) + else if(!SpellMgr::IsSpellValid(spellInfo)) { sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast); qinfo->RewSpellCast = 0; // no spell will be casted on player } - if(GetTalentSpellCost(qinfo->RewSpellCast)) + else if(GetTalentSpellCost(qinfo->RewSpellCast)) { sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast); qinfo->RewSpellCast = 0; // no spell will be casted on player - continue; } } @@ -7631,7 +7629,7 @@ bool PlayerCondition::Meets(Player const * player) const case CONDITION_REPUTATION_RANK: { FactionEntry const* faction = sFactionStore.LookupEntry(value1); - return faction && player->GetReputationMgr().GetRank(faction) >= value2; + return faction && uint32(player->GetReputationMgr().GetRank(faction)) >= int32(value2); } case CONDITION_TEAM: return player->GetTeam() == value1; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a110f64dc5a..0e7af6e9f83 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -855,9 +855,9 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen) { - if (MaxValue == DISABLED_MIRROR_TIMER) + if (int(MaxValue) == DISABLED_MIRROR_TIMER) { - if (CurrentValue!=DISABLED_MIRROR_TIMER) + if (int(CurrentValue) != DISABLED_MIRROR_TIMER) StopMirrorTimer(Type); return; } @@ -1580,7 +1580,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) if(!enchantId) continue; - if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)) + if ((enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))) break; } @@ -2400,9 +2400,9 @@ bool Player::IsGroupVisibleFor(Player* p) const bool Player::IsInSameGroupWith(Player const* p) const { - return p==this || GetGroup() != NULL && + return (p==this || (GetGroup() != NULL && GetGroup() == p->GetGroup() && - GetGroup()->SameSubGroup((Player*)this, (Player*)p); + GetGroup()->SameSubGroup((Player*)this, (Player*)p))); } ///- If the player is invited, remove him. If the group if then only 1 person, disband the group. @@ -3284,7 +3284,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL || // lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL - (pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 ) + ((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0)) { switch(GetSkillRangeType(pSkill,_spell_idx->second->racemask!=0)) { @@ -3365,7 +3365,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const { // note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell // talent dependent passives activated at form apply have proper stance data - bool need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))); + bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))))); //Check CasterAuraStates return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))); @@ -3407,7 +3407,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) if (itr == m_spells.end()) return; - if(itr->second->state == PLAYERSPELL_REMOVED || disabled && itr->second->disabled || itr->second->state == PLAYERSPELL_TEMPORARY) + if (itr->second->state == PLAYERSPELL_REMOVED || (disabled && itr->second->disabled) || itr->second->state == PLAYERSPELL_TEMPORARY) return; // unlearn non talent higher ranks (recursive) @@ -3524,7 +3524,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) if(_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL && pSkill->categoryId != SKILL_CATEGORY_CLASS ||// not unlearn class skills (spellbook/talent pages) // lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL - (pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 ) + ((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0)) { // not reset skills for professions and racial abilities if ((pSkill->categoryId==SKILL_CATEGORY_SECONDARY || pSkill->categoryId==SKILL_CATEGORY_PROFESSION) && @@ -4771,7 +4771,7 @@ void Player::RepopAtGraveyard() AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId()); // Such zones are considered unreachable as a ghost and the player must be automatically revived - if(!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY || GetTransport() || GetPositionZ() < -500.0f) + if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport() || GetPositionZ() < -500.0f) { ResurrectPlayer(0.5f); SpawnCorpseBones(); @@ -7094,7 +7094,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl // If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage if (ssv) { - if (extraDPS = ssv->getDPSMod(proto->ScalingStatValue)) + if ((extraDPS = ssv->getDPSMod(proto->ScalingStatValue))) { float average = extraDPS * proto->Delay / 1000.0f; minDamage = 0.7f * average; @@ -9012,10 +9012,10 @@ Item* Player::GetItemByPos( uint16 pos ) const Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const { - if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) ) + if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END )) ) return m_items[slot]; - else if(bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END - || bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END ) + else if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END) + || (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END) ) { Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); if ( pBag ) @@ -11664,7 +11664,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) if(IsEquipmentPos ( src ) || IsBagPos ( src )) { // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) - uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty()); + uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty())); if(msg != EQUIP_ERR_OK) { SendEquipError( msg, pSrcItem, pDstItem ); @@ -11694,7 +11694,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) if(IsEquipmentPos ( dst ) || IsBagPos ( dst )) { // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) - uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty()); + uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty())); if(msg != EQUIP_ERR_OK) { SendEquipError( msg, pSrcItem, pDstItem ); @@ -11914,19 +11914,19 @@ void Player::SwapItem( uint16 src, uint16 dst ) RemoveItem(srcbag, srcslot, false); // add to dest - if( IsInventoryPos( dst ) ) + if (IsInventoryPos(dst)) StoreItem(sDest, pSrcItem, true); - else if( IsBankPos( dst ) ) + else if (IsBankPos(dst)) BankItem(sDest, pSrcItem, true); - else if( IsEquipmentPos( dst ) ) + else if (IsEquipmentPos(dst)) EquipItem(eDest, pSrcItem, true); // add to src - if( IsInventoryPos( src ) ) + if (IsInventoryPos(src)) StoreItem(sDest2, pDstItem, true); - else if( IsBankPos( src ) ) + else if (IsBankPos(src)) BankItem(sDest2, pDstItem, true); - else if( IsEquipmentPos( src ) ) + else if (IsEquipmentPos(src)) EquipItem(eDest2, pDstItem, true); AutoUnequipOffhandIfNeed(); @@ -11934,11 +11934,11 @@ void Player::SwapItem( uint16 src, uint16 dst ) void Player::AddItemToBuyBackSlot( Item *pItem ) { - if( pItem ) + if (pItem) { uint32 slot = m_currentBuybackSlot; // if current back slot non-empty search oldest or free - if(m_items[slot]) + if (m_items[slot]) { uint32 oldest_time = GetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 ); uint32 oldest_slot = BUYBACK_SLOT_START; @@ -11946,7 +11946,7 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) for(uint32 i = BUYBACK_SLOT_START+1; i < BUYBACK_SLOT_END; ++i ) { // found empty - if(!m_items[i]) + if (!m_items[i]) { slot = i; break; @@ -11954,7 +11954,7 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) uint32 i_time = GetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + i - BUYBACK_SLOT_START); - if(oldest_time > i_time) + if (oldest_time > i_time) { oldest_time = i_time; oldest_slot = i; @@ -11974,15 +11974,14 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) uint32 eslot = slot - BUYBACK_SLOT_START; SetUInt64Value( PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID() ); - ItemPrototype const *pProto = pItem->GetProto(); - if( pProto ) + if (ItemPrototype const *pProto = pItem->GetProto()) SetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount() ); else SetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0 ); SetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, (uint32)etime ); // move to next (for non filled list is move most optimized choice) - if(m_currentBuybackSlot < BUYBACK_SLOT_END - 1) + if (m_currentBuybackSlot < BUYBACK_SLOT_END - 1) ++m_currentBuybackSlot; } } @@ -11990,7 +11989,7 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) Item* Player::GetItemFromBuyBackSlot( uint32 slot ) { sLog.outDebug( "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); - if( slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END ) + if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) return m_items[slot]; return NULL; } @@ -11998,10 +11997,10 @@ Item* Player::GetItemFromBuyBackSlot( uint32 slot ) void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del ) { sLog.outDebug( "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); - if( slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END ) + if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) { Item *pItem = m_items[slot]; - if( pItem ) + if (pItem) { pItem->RemoveFromWorld(); if(del) pItem->SetState(ITEM_REMOVED, this); @@ -12023,21 +12022,21 @@ void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del ) void Player::SendEquipError( uint8 msg, Item* pItem, Item *pItem2 ) { sLog.outDebug( "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); - WorldPacket data( SMSG_INVENTORY_CHANGE_FAILURE, (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I ? 22 : 18) ); + WorldPacket data(SMSG_INVENTORY_CHANGE_FAILURE, (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I ? 22 : 18)); data << uint8(msg); - if(msg) + if (msg != EQUIP_ERR_OK) { data << uint64(pItem ? pItem->GetGUID() : 0); data << uint64(pItem2 ? pItem2->GetGUID() : 0); data << uint8(0); // not 0 there... - if(msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I) + if (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I) { uint32 level = 0; - if(pItem) - if(ItemPrototype const* proto = pItem->GetProto()) + if (pItem) + if (ItemPrototype const* proto = pItem->GetProto()) level = proto->RequiredLevel; data << uint32(level); // new 2.4.0 @@ -12052,7 +12051,7 @@ void Player::SendBuyError( uint8 msg, Creature* pCreature, uint32 item, uint32 p WorldPacket data( SMSG_BUY_FAILED, (8+4+4+1) ); data << uint64(pCreature ? pCreature->GetGUID() : 0); data << uint32(item); - if( param > 0 ) + if (param > 0) data << uint32(param); data << uint8(msg); GetSession()->SendPacket(&data); @@ -12064,7 +12063,7 @@ void Player::SendSellError( uint8 msg, Creature* pCreature, uint64 guid, uint32 WorldPacket data( SMSG_SELL_ITEM,(8+8+(param?4:0)+1)); // last check 2.0.10 data << uint64(pCreature ? pCreature->GetGUID() : 0); data << uint64(guid); - if( param > 0 ) + if (param > 0) data << uint32(param); data << uint8(msg); GetSession()->SendPacket(&data); @@ -12080,15 +12079,15 @@ void Player::ClearTrade() void Player::TradeCancel(bool sendback) { - if(pTrader) + if (pTrader) { // send yellow "Trade canceled" message to both traders WorldSession* ws; ws = GetSession(); - if(sendback) + if (sendback) ws->SendCancelTrade(); ws = pTrader->GetSession(); - if(!ws->PlayerLogout()) + if (!ws->PlayerLogout()) ws->SendCancelTrade(); // cleanup @@ -12102,7 +12101,7 @@ void Player::TradeCancel(bool sendback) void Player::UpdateItemDuration(uint32 time, bool realtimeonly) { - if(m_itemDuration.empty()) + if (m_itemDuration.empty()) return; sLog.outDebug("Player::UpdateItemDuration(%u,%u)", time, realtimeonly); @@ -12112,7 +12111,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly) Item* item = *itr; ++itr; // current element can be erased in UpdateDuration - if (realtimeonly && item->GetProto()->Duration < 0 || !realtimeonly) + if ((realtimeonly && item->GetProto()->Duration < 0) || !realtimeonly) item->UpdateDuration(this,time); } } @@ -12123,17 +12122,17 @@ void Player::UpdateEnchantTime(uint32 time) { assert(itr->item); next = itr; - if(!itr->item->GetEnchantmentId(itr->slot)) + if (!itr->item->GetEnchantmentId(itr->slot)) { next = m_enchantDuration.erase(itr); } - else if(itr->leftduration <= time) + else if (itr->leftduration <= time) { ApplyEnchantment(itr->item, itr->slot, false, false); itr->item->ClearEnchantment(itr->slot); next = m_enchantDuration.erase(itr); } - else if(itr->leftduration > time) + else if (itr->leftduration > time) { itr->leftduration -= time; ++next; @@ -12145,11 +12144,11 @@ void Player::AddEnchantmentDurations(Item *item) { for(int x = 0; x < MAX_ENCHANTMENT_SLOT; ++x) { - if(!item->GetEnchantmentId(EnchantmentSlot(x))) + if (!item->GetEnchantmentId(EnchantmentSlot(x))) continue; uint32 duration = item->GetEnchantmentDuration(EnchantmentSlot(x)); - if( duration > 0 ) + if (duration > 0) AddEnchantmentDuration(item, EnchantmentSlot(x), duration); } } @@ -12158,7 +12157,7 @@ void Player::RemoveEnchantmentDurations(Item *item) { for(EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end();) { - if(itr->item == item) + if (itr->item == item) { // save duration in item item->SetEnchantmentDuration(EnchantmentSlot(itr->slot), itr->leftduration); @@ -12175,9 +12174,9 @@ void Player::RemoveArenaEnchantments(EnchantmentSlot slot) for(EnchantDurationList::iterator itr = m_enchantDuration.begin(), next; itr != m_enchantDuration.end(); itr = next) { next = itr; - if(itr->slot == slot) + if (itr->slot == slot) { - if(itr->item && itr->item->GetEnchantmentId(slot)) + if (itr->item && itr->item->GetEnchantmentId(slot)) { // Poisons and DK runes are enchants which are allowed on arenas if (spellmgr.IsArenaAllowedEnchancment(itr->item->GetEnchantmentId(slot))) @@ -12200,48 +12199,39 @@ void Player::RemoveArenaEnchantments(EnchantmentSlot slot) // remove enchants from inventory items // NOTE: no need to remove these from stats, since these aren't equipped // in inventory - for(uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) - { - Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - if( pItem && pItem->GetEnchantmentId(slot) ) - pItem->ClearEnchantment(slot); - } + for(uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (pItem->GetEnchantmentId(slot)) + pItem->ClearEnchantment(slot); // in inventory bags - for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) - { - Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - if( pBag ) - { + for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) for(uint32 j = 0; j < pBag->GetBagSize(); j++) - { - Item* pItem = pBag->GetItemByPos(j); - if( pItem && pItem->GetEnchantmentId(slot) ) - pItem->ClearEnchantment(slot); - } - } - } + if (Item* pItem = pBag->GetItemByPos(j)) + if (pItem->GetEnchantmentId(slot)) + pItem->ClearEnchantment(slot); } // duration == 0 will remove item enchant void Player::AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 duration) { - if(!item) + if (!item) return; - if(slot >= MAX_ENCHANTMENT_SLOT) + if (slot >= MAX_ENCHANTMENT_SLOT) return; for(EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr) { - if(itr->item == item && itr->slot == slot) + if (itr->item == item && itr->slot == slot) { itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration); m_enchantDuration.erase(itr); break; } } - if(item && duration > 0 ) + if (item && duration > 0 ) { GetSession()->SendItemEnchantTimeUpdate(GetGUID(), item->GetGUID(), slot, uint32(duration/1000)); m_enchantDuration.push_back(EnchantDuration(item, slot, duration)); @@ -12256,24 +12246,24 @@ void Player::ApplyEnchantment(Item *item,bool apply) void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition) { - if(!item) + if (!item) return; - if(!item->IsEquipped()) + if (!item->IsEquipped()) return; - if(slot >= MAX_ENCHANTMENT_SLOT) + if (slot >= MAX_ENCHANTMENT_SLOT) return; uint32 enchant_id = item->GetEnchantmentId(slot); - if(!enchant_id) + if (!enchant_id) return; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!pEnchant) + if (!pEnchant) return; - if(!ignore_condition && pEnchant->EnchantmentCondition && !((Player*)this)->EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1)) + if (!ignore_condition && pEnchant->EnchantmentCondition && !((Player*)this)->EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1)) return; if (!item->IsBroken()) @@ -12300,9 +12290,9 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(enchant_amount), apply); break; case ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL: - if(enchant_spell_id) + if (enchant_spell_id) { - if(apply) + if (apply) { int32 basepoints = 0; // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor) @@ -12708,34 +12698,35 @@ void Player::PrepareQuestMenu( uint64 guid ) } } -void Player::SendPreparedQuest( uint64 guid ) +void Player::SendPreparedQuest(uint64 guid) { QuestMenu& questMenu = PlayerTalkClass->GetQuestMenu(); - if( questMenu.Empty() ) + if (questMenu.Empty()) return; - QuestMenuItem const& qmi0 = questMenu.GetItem( 0 ); + QuestMenuItem const& qmi0 = questMenu.GetItem(0); uint32 status = qmi0.m_qIcon; // single element case - if ( questMenu.MenuItemCount() == 1 ) + if (questMenu.MenuItemCount() == 1) { // Auto open -- maybe also should verify there is no greeting uint32 quest_id = qmi0.m_qId; Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); - if ( pQuest ) + if (pQuest) { - if( status == DIALOG_STATUS_UNK2 && !GetQuestRewardStatus( quest_id ) ) - PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanRewardQuest(pQuest, false), true ); - else if( status == DIALOG_STATUS_UNK2 ) - PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanRewardQuest(pQuest, false), true ); - // Send completable on repeatable quest if player don't have quest - else if( pQuest->IsRepeatable() && !pQuest->IsDaily() ) - PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanCompleteRepeatableQuest(pQuest), true ); + if (status == DIALOG_STATUS_UNK2 && !GetQuestRewardStatus(quest_id)) + PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanRewardQuest(pQuest, false), true); + else if (status == DIALOG_STATUS_UNK2) + PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanRewardQuest(pQuest, false), true); + // Send completable on repeatable and autoCompletable quest if player don't have quest + // TODO: verify if check for !pQuest->IsDaily() is really correct (possibly not) + else if (pQuest->IsAutoComplete() && pQuest->IsRepeatable() && !pQuest->IsDaily()) + PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanCompleteRepeatableQuest(pQuest), true); else - PlayerTalkClass->SendQuestGiverQuestDetails( pQuest, guid, true ); + PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, guid, true); } } // multiply entries @@ -12748,11 +12739,11 @@ void Player::SendPreparedQuest( uint64 guid ) // need pet case for some quests Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid); - if( pCreature ) + if (pCreature) { uint32 textid = pCreature->GetNpcTextId(); GossipText const* gossiptext = objmgr.GetGossipText(textid); - if( !gossiptext ) + if (!gossiptext) { qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote qe._Emote = 0; //TEXTEMOTE_HELLO; //zyg: NPC emote @@ -12794,7 +12785,7 @@ void Player::SendPreparedQuest( uint64 guid ) } } } - PlayerTalkClass->SendQuestGiverQuestList( qe, title, guid ); + PlayerTalkClass->SendQuestGiverQuestList(qe, title, guid); } } @@ -14750,7 +14741,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // check name limitations if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS || - GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)) + (GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name))) { delete result; CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid); @@ -17934,7 +17925,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL); // in spell case allow 0 model - if (mount_display_id == 0 && spellid == 0 || sourcepath == 0) + if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR); @@ -20395,8 +20386,8 @@ void Player::UpdateCorpseReclaimDelay() { bool pvp = m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH; - if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) || - !pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) + if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) || + (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )) return; time_t now = time(NULL); diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index dd0834b80f4..43f726c42a8 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -31,7 +31,7 @@ INSTANTIATE_SINGLETON_1(PoolHandler); template <class T> PoolGroup<T>::PoolGroup() { - Spawned = 0; + m_SpawnedPoolAmount = 0; } // Method to add a gameobject/creature guid to the proper list depending on pool type and chance value @@ -100,7 +100,7 @@ uint32 PoolGroup<T>::RollOne(void) template<class T> void PoolGroup<T>::DespawnObject(uint32 guid) { - for (int i=0; i<EqualChanced.size(); ++i) + for (size_t i=0; i<EqualChanced.size(); ++i) { if (EqualChanced[i].spawned) { @@ -112,7 +112,8 @@ void PoolGroup<T>::DespawnObject(uint32 guid) Despawn1Object(EqualChanced[i].guid); EqualChanced[i].spawned = false; - Spawned--; + if (m_SpawnedPoolAmount > 0) + --m_SpawnedPoolAmount; } } } @@ -186,14 +187,14 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache) Despawn1Object(CacheValue); CacheValue = Spawn1Object(roll); } - else if (limit < EqualChanced.size() && Spawned < limit) + else if (limit < EqualChanced.size() && m_SpawnedPoolAmount < limit) { std::vector<uint32> IndexList; - for (int i=0; i<EqualChanced.size(); ++i) + for (size_t i=0; i<EqualChanced.size(); ++i) if (!EqualChanced[i].spawned) IndexList.push_back(i); - while (Spawned < limit && IndexList.size() > 0) + while (m_SpawnedPoolAmount < limit && IndexList.size() > 0) { uint32 roll = urand(1, IndexList.size()) - 1; uint32 index = IndexList[roll]; @@ -207,7 +208,8 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache) EqualChanced[index].spawned = ReSpawn1Object(EqualChanced[index].guid); if (EqualChanced[index].spawned) - ++Spawned; // limited group use the Spawned variable to store the number of actualy spawned creatures + ++m_SpawnedPoolAmount; // limited group use the Spawned variable to store the number of actualy spawned creatures + std::vector<uint32>::iterator itr = IndexList.begin()+roll; IndexList.erase(itr); } @@ -215,7 +217,7 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache) } else // Not enough objects in pool, so spawn all { - for (int i=0; i<EqualChanced.size(); ++i) + for (size_t i=0; i<EqualChanced.size(); ++i) EqualChanced[i].spawned = Spawn1Object(EqualChanced[i].guid); } } diff --git a/src/game/PoolHandler.h b/src/game/PoolHandler.h index 8b6c82d1197..7efdae48097 100644 --- a/src/game/PoolHandler.h +++ b/src/game/PoolHandler.h @@ -59,7 +59,7 @@ class PoolGroup uint32 CacheValue; // Store the guid of the removed creature/gameobject during a pool update PoolObjectList ExplicitlyChanced; PoolObjectList EqualChanced; - uint32 Spawned; // Used to know the number of spawned objects + uint32 m_SpawnedPoolAmount; // Used to know the number of spawned objects }; class Pool // for Pool of Pool case diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index d94cd422f11..2331b7ad839 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -208,7 +208,7 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->GetName() && (security > SEC_PLAYER || - (pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && + ((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) && pFriend->IsVisibleGloballyFor(player)) { friendInfo.Status = FRIEND_STATUS_ONLINE; @@ -287,7 +287,7 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet) // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->IsInWorld() && (pFriend->GetSession()->GetSecurity() > SEC_PLAYER || - (pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList) && + ((pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend)) { pFriend->GetSession()->SendPacket(packet); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 5944dd08df3..b214ce5067b 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5363,6 +5363,7 @@ SpellCastResult Spell::CheckCasterAuras() const else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) return SPELL_FAILED_SILENCED; break; + default: break; } } } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index f9ec824e668..9c7f4aca16a 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -239,16 +239,16 @@ inline bool IsElementalShield(SpellEntry const *spellInfo) inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) { - return spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM - && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT - || spellInfo->Id == 64323; // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) + return ((spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM + && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT) + || spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) } inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) { - return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM || + return (spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM || // different random cards from Inscription (121==Virtuoso Inking Set category) - spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] == 121; + (spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] == 121)); } bool IsHigherHankOfSpell(uint32 spellId_1,uint32 spellId_2); diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index d991a96ebe6..526eb46293d 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -327,6 +327,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) } break; } + default: break; } switch(m_form) diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index 66781c1b63b..b4cc62ba39a 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -594,7 +594,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket) // check cheating, can't fail with correct client operations Item* item = _player->GetItemByPos(bag,slot); - if(!item || tradeSlot!=TRADE_SLOT_NONTRADED && !item->CanBeTraded()) + if (!item || (tradeSlot!=TRADE_SLOT_NONTRADED && !item->CanBeTraded())) { SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); return; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d37aa91373a..a49c78bf918 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -13630,7 +13630,6 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) if (!pVictim->GetHealth()) return; - // MrSmite 09-09-2009 PetAI_v1.2 // Inform pets (if any) when player kills target) if (this->GetTypeId() == TYPEID_PLAYER && ((Player*)this)->GetPet()) { diff --git a/src/game/Unit.h b/src/game/Unit.h index 4a62568f613..f8a94c3b678 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -852,9 +852,9 @@ struct SpellPeriodicAuraLogInfo AuraEffect *auraEff; uint32 damage; + uint32 overDamage; // overkill/overheal uint32 absorb; uint32 resist; - uint32 overDamage; // overkill/overheal float multiplier; bool critical; }; diff --git a/src/game/UpdateData.h b/src/game/UpdateData.h index c563911ba74..282ea566c7a 100644 --- a/src/game/UpdateData.h +++ b/src/game/UpdateData.h @@ -21,6 +21,7 @@ #ifndef __UPDATEDATA_H #define __UPDATEDATA_H +#include "ByteBuffer.h" class WorldPacket; enum OBJECT_UPDATE_TYPE diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 8e5b8a501ff..0a11acab88a 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -306,7 +306,7 @@ void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() return; uint32 map0 = i_mapIds[0]; - for(int i = 1; i < i_mapIds.size(); ++i) + for(size_t i = 1; i < i_mapIds.size(); ++i) { if(i_mapIds[i]!=map0) { diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 4cb251d6524..93e3937e168 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -603,14 +603,14 @@ void WorldSession::LoadAccountData(QueryResult* result, uint32 mask) if (type >= NUM_ACCOUNT_DATA_TYPES) { sLog.outError("Table `%s` have invalid account data type (%u), ignore.", - mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data"); + mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } if ((mask & (1 << type))==0) { sLog.outError("Table `%s` have non appropriate for table account data type (%u), ignore.", - mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data"); + mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index d3f66c39d61..8398f2d4161 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -39,6 +39,7 @@ #include "ByteBuffer.h" #include "Opcodes.h" #include "Database/DatabaseEnv.h" +#include "Auth/BigNumber.h" #include "Auth/Sha1.h" #include "WorldSession.h" #include "WorldSocketMgr.h" diff --git a/src/shared/Auth/BigNumber.cpp b/src/shared/Auth/BigNumber.cpp index 8869d3bb9e5..303687c266c 100644 --- a/src/shared/Auth/BigNumber.cpp +++ b/src/shared/Auth/BigNumber.cpp @@ -188,21 +188,6 @@ uint8 *BigNumber::AsByteArray(int minSize) return _array; } -ByteBuffer BigNumber::AsByteBuffer() -{ - ByteBuffer ret(GetNumBytes()); - ret.append(AsByteArray(), GetNumBytes()); - return ret; -} - -std::vector<uint8> BigNumber::AsByteVector() -{ - std::vector<uint8> ret; - ret.resize(GetNumBytes()); - memcpy(&ret[0], AsByteArray(), GetNumBytes()); - return ret; -} - const char *BigNumber::AsHexStr() { return BN_bn2hex(_bn); diff --git a/src/shared/Auth/BigNumber.h b/src/shared/Auth/BigNumber.h index ba116db3965..f1b3a0beda2 100644 --- a/src/shared/Auth/BigNumber.h +++ b/src/shared/Auth/BigNumber.h @@ -22,7 +22,6 @@ #define _AUTH_BIGNUMBER_H #include "Common.h" -#include "ByteBuffer.h" struct bignum_st; @@ -85,8 +84,6 @@ class BigNumber uint32 AsDword(); uint8* AsByteArray(int minSize = 0); - ByteBuffer AsByteBuffer(); - std::vector<uint8> AsByteVector(); const char *AsHexStr(); const char *AsDecStr(); diff --git a/src/shared/Auth/Sha1.cpp b/src/shared/Auth/Sha1.cpp index 8743a14b838..802f1bbcdff 100644 --- a/src/shared/Auth/Sha1.cpp +++ b/src/shared/Auth/Sha1.cpp @@ -19,6 +19,7 @@ */ #include "Auth/Sha1.h" +#include "Auth/BigNumber.h" #include <stdarg.h> Sha1Hash::Sha1Hash() diff --git a/src/shared/Auth/Sha1.h b/src/shared/Auth/Sha1.h index 099cf99321a..bd2b1afa876 100644 --- a/src/shared/Auth/Sha1.h +++ b/src/shared/Auth/Sha1.h @@ -24,7 +24,8 @@ #include "Common.h" #include <openssl/sha.h> #include <openssl/crypto.h> -#include "Auth/BigNumber.h" + +class BigNumber; class Sha1Hash { diff --git a/src/shared/Threading.cpp b/src/shared/Threading.cpp index 652f468772f..90861b8f425 100644 --- a/src/shared/Threading.cpp +++ b/src/shared/Threading.cpp @@ -17,6 +17,7 @@ */ #include "Threading.h" +#include "Errors.h" #include <ace/OS_NS_unistd.h> #include <ace/Sched_Params.h> #include <vector> diff --git a/src/shared/Threading.h b/src/shared/Threading.h index 6c3f3724bc1..574b9641aac 100644 --- a/src/shared/Threading.h +++ b/src/shared/Threading.h @@ -23,7 +23,6 @@ #include <ace/TSS_T.h> #include "ace/Atomic_Op.h" #include <assert.h> -#include "Errors.h" namespace ACE_Based { diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index b8c51461a67..67d3728e5e5 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -305,11 +305,7 @@ int Master::Run() uint32 realCurrTime, realPrevTime; realCurrTime = realPrevTime = getMSTime(); - uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME); - - // maximum counter for next ping - uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / socketSelecttime)); - uint32 loopCounter = 0; + uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME); ///- Start up freeze catcher thread if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0)) diff --git a/src/trinityrealm/AuthSocket.cpp b/src/trinityrealm/AuthSocket.cpp index 60a55be77f3..d5c9e1445fb 100644 --- a/src/trinityrealm/AuthSocket.cpp +++ b/src/trinityrealm/AuthSocket.cpp @@ -492,9 +492,9 @@ bool AuthSocket::_HandleLogonChallenge() pkt << uint8(1); pkt.append(g.AsByteArray(), 1); pkt << uint8(32); - pkt.append(N.AsByteArray(), 32); + pkt.append(N.AsByteArray(32), 32); pkt.append(s.AsByteArray(), s.GetNumBytes()); // 32 bytes - pkt.append(unk3.AsByteArray(), 16); + pkt.append(unk3.AsByteArray(16), 16); uint8 securityFlags = 0; pkt << uint8(securityFlags); // security flags (0x0...0x04) @@ -829,7 +829,7 @@ bool AuthSocket::_HandleReconnectChallenge() pkt << (uint8) AUTH_RECONNECT_CHALLENGE; pkt << (uint8) 0x00; _reconnectProof.SetRand(16 * 8); - pkt.append(_reconnectProof.AsByteBuffer()); // 16 bytes random + pkt.append(_reconnectProof.AsByteArray(16), 16); // 16 bytes random pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros SendBuf((char const*)pkt.contents(), pkt.size()); return true; |