From 90828fa699ef3c6929c9ffe23a87ed7c32a8c978 Mon Sep 17 00:00:00 2001 From: hunuza Date: Wed, 5 Nov 2008 16:58:57 +0100 Subject: [PATCH] Cache highest arena team/guild ids. Some code clean up. --- src/game/ArenaTeam.cpp | 8 +--- src/game/BattleGround.cpp | 4 +- src/game/BattleGroundEY.cpp | 20 ++++----- src/game/BattleGroundMgr.cpp | 6 +-- src/game/BattleGroundWS.cpp | 32 +++++++------- src/game/Cell.h | 4 +- src/game/GameObject.cpp | 2 +- src/game/Group.cpp | 2 +- src/game/Guild.cpp | 38 +++++++--------- src/game/GuildHandler.cpp | 4 +- src/game/Map.cpp | 2 +- src/game/ObjectMgr.cpp | 55 ++++++++++++++++++----- src/game/ObjectMgr.h | 4 ++ src/game/Player.cpp | 8 ++-- src/game/Player.h | 6 +-- src/game/Spell.cpp | 2 +- src/game/SpellEffects.cpp | 14 +++--- src/game/Totem.cpp | 10 ++--- src/game/Transports.cpp | 10 ++--- src/game/Traveller.h | 2 +- src/game/Unit.cpp | 14 +++--- src/game/WorldSocket.cpp | 86 ++++++++++++++++++------------------ src/game/WorldSocketMgr.cpp | 10 ++--- 23 files changed, 183 insertions(+), 160 deletions(-) diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index b8796f61a..06336fe70 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -57,13 +57,7 @@ bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam Name = ArenaTeamName; Type = type; - QueryResult *result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team"); - if( result ) - { - Id = (*result)[0].GetUInt32()+1; - delete result; - } - else Id = 1; + Id = objmgr.GenerateArenaTeamId(); // ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB CharacterDatabase.escape_string(ArenaTeamName); diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 7cb417ce5..2781ef6e2 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -673,7 +673,7 @@ void BattleGround::Reset() m_PlayerScores.clear(); // reset BGSubclass - this->ResetBGSubclass(); + ResetBGSubclass(); } void BattleGround::StartBattleGround() @@ -1033,7 +1033,7 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float if(!pCreature) { sLog.outError("Can't create Spirit guide. BattleGround not created!"); - this->EndNow(); + EndNow(); return false; } diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 5eb6d6286..18d08595d 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -133,10 +133,10 @@ void BattleGroundEY::Update(time_t diff) /*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times but we can count of players on current point in CheckSomeoneLeftPoint */ - this->CheckSomeoneJoinedPoint(); + CheckSomeoneJoinedPoint(); //check if player left point - this->CheckSomeoneLeftPoint(); - this->UpdatePointStatuses(); + CheckSomeoneLeftPoint(); + UpdatePointStatuses(); m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME; } } @@ -221,7 +221,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() { m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); - this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr); + UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr); } else { @@ -264,17 +264,17 @@ void BattleGroundEY::UpdatePointStatuses() Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[point][i]); if (plr) { - this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); + UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); //if point owner changed we must evoke event! if (pointOwnerTeamId != m_PointOwnedByTeam[point]) { //point was uncontrolled and player is from team which captured point if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId) - this->EventTeamCapturedPoint(plr, point); + EventTeamCapturedPoint(plr, point); //point was under control and player isn't from team which controlled it if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point]) - this->EventTeamLostPoint(plr, point); + EventTeamLostPoint(plr, point); } } } @@ -350,7 +350,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid) if(m_FlagKeeper == guid) { if(plr) - this->EventPlayerDroppedFlag(plr); + EventPlayerDroppedFlag(plr); else { SetFlagPicker(0); @@ -610,7 +610,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) { - if(GetStatus() != STATUS_IN_PROGRESS || this->IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10)) + if(GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10)) return; const char *message; @@ -750,7 +750,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType) { - if(GetStatus() != STATUS_IN_PROGRESS || this->GetFlagPickerGUID() != Source->GetGUID()) + if(GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID()) return; uint8 type = 0; diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 046f18b48..5cee001fa 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -80,7 +80,7 @@ void BattleGroundQueue::AddPlayer(Player *plr, uint32 bgTypeId) else ++m_QueuedPlayers[queue_id].Horde; - this->Update(bgTypeId, queue_id); + Update(bgTypeId, queue_id); if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) ) { @@ -183,7 +183,7 @@ void BattleGroundQueue::Update(uint32 bgTypeId, uint32 queue_id) } //if no players in queue ... do nothing - if (this->m_QueuedPlayers[queue_id].Alliance == 0 && this->m_QueuedPlayers[queue_id].Horde == 0) + if (m_QueuedPlayers[queue_id].Alliance == 0 && m_QueuedPlayers[queue_id].Horde == 0) return; //battleground with free slot for player should be always the last in this queue @@ -625,7 +625,7 @@ void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Pla void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID) { // set invited player counters: - BattleGround* bg = this->GetBattleGround(bgInstanceGUID); + BattleGround* bg = GetBattleGround(bgInstanceGUID); if(!bg) return; diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index dfaf0d006..23c90a763 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -217,7 +217,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if(Source->GetTeam() == ALLIANCE) { - if (!this->IsHordeFlagPickedup()) + if (!IsHordeFlagPickedup()) return; SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) @@ -234,7 +234,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) } else { - if (!this->IsAllianceFlagPickedup()) + if (!IsAllianceFlagPickedup()) return; SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) @@ -293,7 +293,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) if(Source->GetTeam() == ALLIANCE) { - if(!this->IsHordeFlagPickedup()) + if(!IsHordeFlagPickedup()) return; if(GetHordeFlagPickerGUID() == Source->GetGUID()) { @@ -308,7 +308,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) } else { - if(!this->IsAllianceFlagPickedup()) + if(!IsAllianceFlagPickedup()) return; if(GetAllianceFlagPickerGUID() == Source->GetGUID()) { @@ -349,8 +349,8 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target uint8 type = 0; //alliance flag picked up from base - if(Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE - && this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) + if(Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE + && m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) { message = GetMangosString(LANG_BG_WS_PICKEDUP_AF); type = CHAT_MSG_BG_SYSTEM_HORDE; @@ -365,8 +365,8 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target } //horde flag picked up from base - if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE - && this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) + if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE + && m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) { message = GetMangosString(LANG_BG_WS_PICKEDUP_HF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; @@ -381,7 +381,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target } //Alliance flag on ground(not in base) (returned or picked up again from ground!) - if(this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) + if(GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) { if(Source->GetTeam() == ALLIANCE) { @@ -410,7 +410,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target } //Horde flag on ground(not in base) (returned or picked up again) - if(this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) + if(GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) { if(Source->GetTeam() == HORDE) { @@ -455,22 +455,22 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid) if(!plr) { sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); - this->SetAllianceFlagPicker(0); - this->RespawnFlag(ALLIANCE, false); + SetAllianceFlagPicker(0); + RespawnFlag(ALLIANCE, false); } else - this->EventPlayerDroppedFlag(plr); + EventPlayerDroppedFlag(plr); } if(IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid) { if(!plr) { sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); - this->SetHordeFlagPicker(0); - this->RespawnFlag(HORDE, false); + SetHordeFlagPicker(0); + RespawnFlag(HORDE, false); } else - this->EventPlayerDroppedFlag(plr); + EventPlayerDroppedFlag(plr); } } diff --git a/src/game/Cell.h b/src/game/Cell.h index 5fc4177d3..b0ff85d89 100644 --- a/src/game/Cell.h +++ b/src/game/Cell.h @@ -119,7 +119,7 @@ struct MANGOS_DLL_DECL Cell Cell& operator=(const Cell &cell) { - this->data.All = cell.data.All; + data.All = cell.data.All; return *this; } @@ -154,7 +154,7 @@ struct MANGOS_DLL_DECL CellLock operator const Cell &(void) const { return i_cell; } CellLock& operator=(const CellLock &cell) { - this->~CellLock(); + ~CellLock(); new (this) CellLock(cell); return *this; } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 9f28d7291..1f17d6f3a 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -407,7 +407,7 @@ void GameObject::Update(uint32 /*p_time*/) //burning flags in some battlegrounds, if you find better condition, just add it if (GetGoAnimProgress() > 0) { - SendObjectDeSpawnAnim(this->GetGUID()); + SendObjectDeSpawnAnim(GetGUID()); //reset flags SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); } diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 36bccee2f..cb03edabd 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1305,7 +1305,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed ) void Roll::targetObjectBuildLink() { // called from link() - this->getTarget()->addLootValidatorRef(this); + getTarget()->addLootValidatorRef(this); } void Group::SetDifficulty(uint8 difficulty) diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 617e9b9f6..851aa0086 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -69,13 +69,7 @@ bool Guild::create(uint64 lGuid, std::string gname) guildbank_money = 0; purchased_tabs = 0; - QueryResult *result = CharacterDatabase.Query( "SELECT MAX(guildid) FROM guild" ); - if( result ) - { - Id = (*result)[0].GetUInt32()+1; - delete result; - } - else Id = 1; + Id = objmgr.GenerateGuildId(); // gname already assigned to Guild::name, use it to encode string for DB CharacterDatabase.escape_string(gname); @@ -410,18 +404,16 @@ void Guild::LoadPlayerStatsByGuid(uint64 guid) void Guild::SetLeader(uint64 guid) { leaderGuid = guid; - this->ChangeRank(guid, GR_GUILDMASTER); + ChangeRank(guid, GR_GUILDMASTER); CharacterDatabase.PExecute("UPDATE guild SET leaderguid='%u' WHERE guildid='%u'", GUID_LOPART(guid), Id); } void Guild::DelMember(uint64 guid, bool isDisbanding) { - if(this->leaderGuid == guid && !isDisbanding) + if(leaderGuid == guid && !isDisbanding) { - std::ostringstream ss; - ss<<"SELECT guid FROM guild_member WHERE guildid='"<SetLeader(newLeaderGUID); + SetLeader(newLeaderGUID); newLeader = objmgr.GetPlayer(newLeaderGUID); if(newLeader) @@ -453,20 +445,20 @@ void Guild::DelMember(uint64 guid, bool isDisbanding) data << (uint8)2; data << oldLeaderName; data << newLeaderName; - this->BroadcastPacket(&data); + BroadcastPacket(&data); data.Initialize(SMSG_GUILD_EVENT, (1+1+oldLeaderName.size()+1)); data << (uint8)GE_LEFT; data << (uint8)1; data << oldLeaderName; - this->BroadcastPacket(&data); + BroadcastPacket(&data); } sLog.outDebug( "WORLD: Sent (SMSG_GUILD_EVENT)" ); } else { - this->Disband(); + Disband(); return; } } @@ -662,7 +654,7 @@ void Guild::Disband() { WorldPacket data(SMSG_GUILD_EVENT, 1); data << (uint8)GE_DISBANDED; - this->BroadcastPacket(&data); + BroadcastPacket(&data); while (!members.empty()) { @@ -762,11 +754,11 @@ void Guild::Query(WorldSession *session) void Guild::SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor) { - this->EmblemStyle = emblemStyle; - this->EmblemColor = emblemColor; - this->BorderStyle = borderStyle; - this->BorderColor = borderColor; - this->BackgroundColor = backgroundColor; + EmblemStyle = emblemStyle; + EmblemColor = emblemColor; + BorderStyle = borderStyle; + BorderColor = borderColor; + BackgroundColor = backgroundColor; CharacterDatabase.PExecute("UPDATE guild SET EmblemStyle=%u, EmblemColor=%u, BorderStyle=%u, BorderColor=%u, BackgroundColor=%u WHERE guildid = %u", EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, Id); } @@ -1950,7 +1942,7 @@ void Guild::SendGuildBankTabText(WorldSession *session, uint8 TabId) bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const &vec) const { for(GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr) - if(itr->slot == this->slot) + if(itr->slot == slot) return true; return false; diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 2fd9c2174..8d5c66047 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -347,7 +347,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); return; } - else if((plRankId-1) == 0 || (plRankId-1) < this->GetPlayer()->GetRank()) + else if((plRankId-1) == 0 || (plRankId-1) < GetPlayer()->GetRank()) return; if(plRankId < 1) @@ -434,7 +434,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) return; } - if((plRankId+1) >= guild->GetNrRanks() || plRankId <= this->GetPlayer()->GetRank()) + if((plRankId+1) >= guild->GetNrRanks() || plRankId <= GetPlayer()->GetRank()) return; guild->ChangeRank(plGuid, (plRankId+1)); diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 7518cf170..5acd83b07 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -418,7 +418,7 @@ Map::LoadGrid(const Cell& cell, bool no_unload) bool Map::Add(Player *player) { - player->SetInstanceId(this->GetInstanceId()); + player->SetInstanceId(GetInstanceId()); // update player state for other player and visa-versa CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 724880f5d..7740f838f 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -355,7 +355,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction ) sLog.outDebug( "AuctionWon body string : %s", msgAuctionWonBody.str().c_str() ); //prepare mail data... : - uint32 itemTextId = this->CreateItemText( msgAuctionWonBody.str() ); + uint32 itemTextId = CreateItemText( msgAuctionWonBody.str() ); // set owner to bidder (to prevent delete item with sender char deleting) // owner in `data` will set at mail receive and item extracting @@ -406,7 +406,7 @@ void ObjectMgr::SendAuctionSalePendingMail( AuctionEntry * auction ) sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); - uint32 itemTextId = this->CreateItemText( msgAuctionSalePendingBody.str() ); + uint32 itemTextId = CreateItemText( msgAuctionSalePendingBody.str() ); WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, auction->owner, msgAuctionSalePendingSubject.str(), itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_AUCTION); } @@ -438,7 +438,7 @@ void ObjectMgr::SendAuctionSuccessfulMail( AuctionEntry * auction ) sLog.outDebug("AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str()); - uint32 itemTextId = this->CreateItemText( auctionSuccessfulBody.str() ); + uint32 itemTextId = CreateItemText( auctionSuccessfulBody.str() ); uint32 profit = auction->bid + auction->deposit - auctionCut; @@ -1418,7 +1418,7 @@ void ObjectMgr::LoadAuctions() aItem->deposit = fields[10].GetUInt32(); aItem->location = fields[11].GetUInt8(); //check if sold item exists - if ( this->GetAItem( aItem->item_guidlow ) ) + if ( GetAItem( aItem->item_guidlow ) ) { GetAuctionsMap( aItem->location )->AddAuction(aItem); } @@ -5016,13 +5016,8 @@ void ObjectMgr::SetHighestGuids() delete result; } - result = CharacterDatabase.Query( "SELECT MAX(id) FROM character_pet" ); - if( result ) - { - m_hiPetGuid = (*result)[0].GetUInt32()+1; - - delete result; - } + // pet guids are not saved to DB, set to 0 (pet guid != pet id) + m_hiPetGuid = 0; result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" ); if( result ) @@ -5085,6 +5080,44 @@ void ObjectMgr::SetHighestGuids() delete result; } + + result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team"); + if (result) + { + m_arenaTeamId = (*result)[0].GetUInt32()+1; + + delete result; + } + + result = CharacterDatabase.Query( "SELECT MAX(guildid) FROM guild" ); + if (result) + { + m_guildId = (*result)[0].GetUInt32()+1; + + delete result; + } +} + +uint32 ObjectMgr::GenerateArenaTeamId() +{ + ++m_arenaTeamId; + if(m_arenaTeamId>=0xFFFFFFFF) + { + sLog.outError("Arena team ids overflow!! Can't continue, shuting down server. "); + sWorld.m_stopEvent = true; + } + return m_arenaTeamId; +} + +uint32 ObjectMgr::GenerateGuildId() +{ + ++m_guildId; + if(m_guildId>=0xFFFFFFFF) + { + sLog.outError("Guild ids overflow!! Can't continue, shuting down server. "); + sWorld.m_stopEvent = true; + } + return m_guildId; } uint32 ObjectMgr::GenerateAuctionID() diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 6e0b178ea..a849df1f9 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -569,6 +569,8 @@ class ObjectMgr uint32 GenerateMailID(); uint32 GenerateItemTextID(); uint32 GeneratePetNumber(); + uint32 GenerateArenaTeamId(); + uint32 GenerateGuildId(); uint32 CreateItemText(std::string text); std::string GetItemText( uint32 id ) @@ -758,6 +760,8 @@ class ObjectMgr uint32 m_auctionid; uint32 m_mailid; uint32 m_ItemTextId; + uint32 m_arenaTeamId; + uint32 m_guildId; uint32 m_hiCharGuid; uint32 m_hiCreatureGuid; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a89b11343..bdda33851 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1476,7 +1476,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // The player was ported to another map and looses the duel immediatly. // We have to perform this check before the teleport, otherwise the // ObjectAccessor won't find the flag. - if (duel && this->GetMapId()!=mapid) + if (duel && GetMapId()!=mapid) { GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER)); if (obj) @@ -1486,7 +1486,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // reset movement flags at teleport, because player will continue move with these flags after teleport SetUnitMovementFlags(0); - if ((this->GetMapId() == mapid) && (!m_transport)) + if ((GetMapId() == mapid) && (!m_transport)) { // prepare zone change detect uint32 old_zone = GetZoneId(); @@ -6779,7 +6779,7 @@ void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attTy } if (roll_chance_f(chance)) - this->CastSpell(Target, spellInfo->Id, true, item); + CastSpell(Target, spellInfo->Id, true, item); } // item combat enchantments @@ -18133,7 +18133,7 @@ void Player::SetCanBlock( bool value ) bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const { for(ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr) - if(itr->pos == this->pos) + if(itr->pos == pos) return true; return false; diff --git a/src/game/Player.h b/src/game/Player.h index 2d8275ec6..a5222d308 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1507,8 +1507,8 @@ class MANGOS_DLL_SPEC Player : public Unit void RemoveFromGroup() { RemoveFromGroup(GetGroup(),GetGUID()); } void SendUpdateToOutOfRangeGroupMembers(); - void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); Player::SetUInt32ValueInDB(PLAYER_GUILDID, GuildId, this->GetGUID()); } - void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, rankId, this->GetGUID()); } + void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); Player::SetUInt32ValueInDB(PLAYER_GUILDID, GuildId, GetGUID()); } + void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, rankId, GetGUID()); } void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); } static uint32 GetGuildIdFromDB(uint64 guid); @@ -1521,7 +1521,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot) { SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId); - SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId, this->GetGUID()); + SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId, GetGUID()); } uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6)); } static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 0938a6292..7faf701cf 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3142,7 +3142,7 @@ void Spell::TriggerSpell() { for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) { - Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, this->m_selfContainer); + Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer); spell->prepare(&m_targets); // use original spell original targets } } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 61a5e329c..ef129fa1e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2228,7 +2228,7 @@ void Spell::EffectSendEvent(uint32 EffectIndex) case 23333: // Pickup Horde Flag /*do not uncomment . if(bg->GetTypeID()==BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); sLog.outDebug("Send Event Horde Flag Picked Up"); break; /* not used : @@ -2241,7 +2241,7 @@ void Spell::EffectSendEvent(uint32 EffectIndex) case 23335: // Pickup Alliance Flag /*do not uncomment ... (it will cause crash, because of null targetobject!) anyway this is a bad way to call that event, because it would cause recursion if(bg->GetTypeID()==BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); sLog.outDebug("Send Event Alliance Flag Picked Up"); break; /* not used : @@ -2252,18 +2252,18 @@ void Spell::EffectSendEvent(uint32 EffectIndex) break; case 23385: // Alliance Flag Returns if(bg->GetTypeID()==BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); sLog.outDebug("Alliance Flag Returned"); break; case 23386: // Horde Flag Returns if(bg->GetTypeID()==BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); sLog.outDebug("Horde Flag Returned"); break;*/ case 34976: /* if(bg->GetTypeID()==BATTLEGROUND_EY) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); */ break; default: @@ -3685,13 +3685,13 @@ void Spell::EffectAddHonor(uint32 /*i*/) if(unitTarget->GetTypeId() != TYPEID_PLAYER) return; - sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, this->damage, ((Player*)unitTarget)->GetGUIDLow()); + sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, damage, ((Player*)unitTarget)->GetGUIDLow()); // TODO: find formula for honor reward based on player's level! // now fixed only for level 70 players: if (((Player*)unitTarget)->getLevel() == 70) - ((Player*)unitTarget)->RewardHonor(NULL, 1, this->damage); + ((Player*)unitTarget)->RewardHonor(NULL, 1, damage); } void Spell::EffectTradeSkill(uint32 /*i*/) diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 31226900d..5c708bf0c 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -35,7 +35,7 @@ Totem::Totem() : Creature() void Totem::Update( uint32 time ) { Unit *owner = GetOwner(); - if (!owner || !owner->isAlive() || !this->isAlive()) + if (!owner || !owner->isAlive() || !isAlive()) { UnSummon(); // remove self return; @@ -89,7 +89,7 @@ void Totem::UnSummon() CombatStop(); RemoveAurasDueToSpell(GetSpell()); - Unit *owner = this->GetOwner(); + Unit *owner = GetOwner(); if (owner) { // clear owenr's totem slot @@ -130,11 +130,11 @@ void Totem::SetOwner(uint64 guid) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY, guid); SetUInt64Value(UNIT_FIELD_CREATEDBY, guid); - Unit *owner = this->GetOwner(); + Unit *owner = GetOwner(); if (owner) { - this->setFaction(owner->getFaction()); - this->SetLevel(owner->getLevel()); + setFaction(owner->getFaction()); + SetLevel(owner->getLevel()); } } diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 2cdf080f7..658fd8f8c 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -464,7 +464,7 @@ bool Transport::AddPassenger(Player* passenger) { if (m_passengers.find(passenger) == m_passengers.end()) { - sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), this->m_name.c_str()); + sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), m_name.c_str()); m_passengers.insert(passenger); } return true; @@ -474,7 +474,7 @@ bool Transport::RemovePassenger(Player* passenger) { if (m_passengers.find(passenger) != m_passengers.end()) { - sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), this->m_name.c_str()); + sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), m_name.c_str()); m_passengers.erase(passenger); } return true; @@ -498,7 +498,7 @@ void Transport::Update(uint32 /*p_time*/) } else { - //MapManager::Instance().GetMap(m_curr->second.mapid)->GameobjectRelocation((GameObject *)this, m_curr->second.x, m_curr->second.y, m_curr->second.z, this->m_orientation); + //MapManager::Instance().GetMap(m_curr->second.mapid)->GameobjectRelocation((GameObject *)this, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_orientation); Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z); } @@ -514,13 +514,13 @@ void Transport::Update(uint32 /*p_time*/) m_nextNodeTime = m_curr->first; if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0) - sLog.outDetail(" ************ BEGIN ************** %s", this->m_name.c_str()); + sLog.outDetail(" ************ BEGIN ************** %s", m_name.c_str()); // MapManager::Instance().GetMap(m_curr->second.mapid)->Add(&this); // -> // ->Add(t); //MapManager::Instance().GetMap(m_curr->second.mapid)->Remove((GameObject *)this, false); // -> // ->Add(t); //MapManager::Instance().GetMap(m_curr->second.mapid)->Add((GameObject *)this); // -> // ->Add(t); if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0) - sLog.outDetail("%s moved to %f %f %f %d", this->m_name.c_str(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); + sLog.outDetail("%s moved to %f %f %f %d", m_name.c_str(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); } } diff --git a/src/game/Traveller.h b/src/game/Traveller.h index a1479d93c..8a7a85d3d 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -37,7 +37,7 @@ struct MANGOS_DLL_DECL Traveller Traveller(const Traveller &obj) : i_traveller(obj) {} Traveller& operator=(const Traveller &obj) { - this->~Traveller(); + ~Traveller(); new (this) Traveller(obj); return *this; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 57b0c912f..b64f538af 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1374,7 +1374,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage { if(!this || !pVictim) return 0; - if(!this->isAlive() || !pVictim->isAlive()) + if(!isAlive() || !pVictim->isAlive()) return 0; SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID); @@ -8076,7 +8076,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT int32 TakenFlatBenefit = 0; // ..done (for creature type by mask) in taken - AuraList const& mDamageDoneCreature = this->GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); + AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) DoneFlatBenefit += (*i)->GetModifier()->m_amount; @@ -8144,7 +8144,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT // SPELL_AURA_MOD_DAMAGE_PERCENT_DONE included in weapon damage // SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT included in weapon damage - AuraList const& mDamageDoneVersus = this->GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); + AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; @@ -8684,7 +8684,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList) //Visible distance is modified by //-Level Diff (every level diff = 1.0f in visible distance) - visibleDistance += int32(u->getLevelForTarget(this)) - int32(this->getLevelForTarget(u)); + visibleDistance += int32(u->getLevelForTarget(this)) - int32(getLevelForTarget(u)); //This allows to check talent tree and will add addition stealth dependent on used points) int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL); @@ -10830,9 +10830,9 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) return NULL; } - pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, this->GetGUID()); - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, this->GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,this->getFaction()); + pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID()); + pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,getFaction()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); if(!pet->InitStatsForLevel(creatureTarget->getLevel())) diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index fdf1d5ed5..63749281a 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -81,7 +81,7 @@ m_Seed (static_cast (rand32 ())), m_OverSpeedPings (0), m_LastPingTime (ACE_Time_Value::zero) { - this->reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } WorldSocket::~WorldSocket (void) @@ -92,9 +92,9 @@ WorldSocket::~WorldSocket (void) if (m_OutBuffer) m_OutBuffer->release (); - this->closing_ = true; + closing_ = true; - this->peer ().close (); + peer ().close (); WorldPacket* pct; while (m_PacketQueue.dequeue_head (pct) == 0) @@ -103,7 +103,7 @@ WorldSocket::~WorldSocket (void) bool WorldSocket::IsClosed (void) const { - return this->closing_; + return closing_; } void WorldSocket::CloseSocket (void) @@ -111,12 +111,12 @@ void WorldSocket::CloseSocket (void) { ACE_GUARD (LockType, Guard, m_OutBufferLock); - if (this->closing_) + if (closing_) return; - this->closing_ = true; + closing_ = true; - this->peer ().close_writer (); + peer ().close_writer (); } { @@ -135,7 +135,7 @@ int WorldSocket::SendPacket (const WorldPacket& pct) { ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - if (this->closing_) + if (closing_) return -1; // Dump outgoing packet. @@ -180,12 +180,12 @@ int WorldSocket::SendPacket (const WorldPacket& pct) long WorldSocket::AddReference (void) { - return static_cast (this->add_reference ()); + return static_cast (add_reference ()); } long WorldSocket::RemoveReference (void) { - return static_cast (this->remove_reference ()); + return static_cast (remove_reference ()); } int WorldSocket::open (void *a) @@ -210,7 +210,7 @@ int WorldSocket::open (void *a) // Store peer address. ACE_INET_Addr remote_addr; - if (this->peer ().get_remote_addr (remote_addr) == -1) + if (peer ().get_remote_addr (remote_addr) == -1) { sLog.outError ("WorldSocket::open: peer ().get_remote_addr errno = %s", ACE_OS::strerror (errno)); return -1; @@ -226,42 +226,42 @@ int WorldSocket::open (void *a) return -1; // Register with ACE Reactor - if (this->reactor ()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) + if (reactor ()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) { sLog.outError ("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); return -1; } // reactor takes care of the socket from now on - this->remove_reference (); + remove_reference (); return 0; } int WorldSocket::close (int) { - this->shutdown (); + shutdown (); - this->closing_ = true; + closing_ = true; - this->remove_reference (); + remove_reference (); return 0; } int WorldSocket::handle_input (ACE_HANDLE) { - if (this->closing_) + if (closing_) return -1; - switch (this->handle_input_missing_data ()) + switch (handle_input_missing_data ()) { case -1 : { if ((errno == EWOULDBLOCK) || (errno == EAGAIN)) { - return this->Update (); // interesting line ,isnt it ? + return Update (); // interesting line ,isnt it ? } DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); @@ -279,7 +279,7 @@ int WorldSocket::handle_input (ACE_HANDLE) case 1: return 1; default: - return this->Update (); // another interesting line ;) + return Update (); // another interesting line ;) } ACE_NOTREACHED(return -1); @@ -289,18 +289,18 @@ int WorldSocket::handle_output (ACE_HANDLE) { ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - if (this->closing_) + if (closing_) return -1; const size_t send_len = m_OutBuffer->length (); if (send_len == 0) - return this->cancel_wakeup_output (Guard); + return cancel_wakeup_output (Guard); #ifdef MSG_NOSIGNAL - ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len, MSG_NOSIGNAL); + ssize_t n = peer ().send (m_OutBuffer->rd_ptr (), send_len, MSG_NOSIGNAL); #else - ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len); + ssize_t n = peer ().send (m_OutBuffer->rd_ptr (), send_len); #endif // MSG_NOSIGNAL if (n == 0) @@ -308,7 +308,7 @@ int WorldSocket::handle_output (ACE_HANDLE) else if (n == -1) { if (errno == EWOULDBLOCK || errno == EAGAIN) - return this->schedule_wakeup_output (Guard); + return schedule_wakeup_output (Guard); return -1; } @@ -319,16 +319,16 @@ int WorldSocket::handle_output (ACE_HANDLE) // move the data to the base of the buffer m_OutBuffer->crunch (); - return this->schedule_wakeup_output (Guard); + return schedule_wakeup_output (Guard); } else //now n == send_len { m_OutBuffer->reset (); if (!iFlushPacketQueue ()) - return this->cancel_wakeup_output (Guard); + return cancel_wakeup_output (Guard); else - return this->schedule_wakeup_output (Guard); + return schedule_wakeup_output (Guard); } ACE_NOTREACHED (return 0); @@ -340,10 +340,10 @@ int WorldSocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask) { ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - this->closing_ = true; + closing_ = true; if (h == ACE_INVALID_HANDLE) - this->peer ().close_writer (); + peer ().close_writer (); } // Critical section @@ -358,13 +358,13 @@ int WorldSocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask) int WorldSocket::Update (void) { - if (this->closing_) + if (closing_) return -1; if (m_OutActive || m_OutBuffer->length () == 0) return 0; - return this->handle_output (this->get_handle ()); + return handle_output (get_handle ()); } int WorldSocket::handle_input_header (void) @@ -416,7 +416,7 @@ int WorldSocket::handle_input_payload (void) ACE_ASSERT (m_Header.space () == 0); ACE_ASSERT (m_RecvWPct != NULL); - const int ret = this->ProcessIncoming (m_RecvWPct); + const int ret = ProcessIncoming (m_RecvWPct); m_RecvPct.base (NULL, 0); m_RecvPct.reset (); @@ -448,7 +448,7 @@ int WorldSocket::handle_input_missing_data (void) const size_t recv_size = message_block.space (); - const ssize_t n = this->peer ().recv (message_block.wr_ptr (), + const ssize_t n = peer ().recv (message_block.wr_ptr (), recv_size); if (n <= 0) @@ -474,7 +474,7 @@ int WorldSocket::handle_input_missing_data (void) } //we just recieved nice new header - if (this->handle_input_header () == -1) + if (handle_input_header () == -1) { ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); return -1; @@ -509,7 +509,7 @@ int WorldSocket::handle_input_missing_data (void) } //just recieved fresh new payload - if (this->handle_input_payload () == -1) + if (handle_input_payload () == -1) { ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); return -1; @@ -528,7 +528,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g) g.release (); - if (this->reactor ()->cancel_wakeup + if (reactor ()->cancel_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { // would be good to store errno from reactor with errno guard @@ -548,7 +548,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g) g.release (); - if (this->reactor ()->schedule_wakeup + if (reactor ()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { sLog.outError ("WorldSocket::schedule_wakeup_output"); @@ -567,7 +567,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) const ACE_UINT16 opcode = new_pct->GetOpcode (); - if (this->closing_) + if (closing_) return -1; // dump recieved packet @@ -853,7 +853,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) return -1; } - std::string address = this->GetRemoteAddress (); + std::string address = GetRemoteAddress (); DEBUG_LOG ("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", account.c_str (), @@ -878,7 +878,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) // In case needed sometime the second arg is in microseconds 1 000 000 = 1 sec ACE_OS::sleep (ACE_Time_Value (0, 10000)); - sWorld.AddSession (this->m_Session); + sWorld.AddSession (m_Session); // Create and send the Addon packet if (sAddOnHandler.BuildAddonPacket (&recvPacket, &SendAddonPacked)) @@ -946,14 +946,14 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) sLog.outError ("WorldSocket::HandlePing: peer sent CMSG_PING, " "but is not authenticated or got recently kicked," " adress = %s", - this->GetRemoteAddress ().c_str ()); + GetRemoteAddress ().c_str ()); return -1; } } WorldPacket packet (SMSG_PONG, 4); packet << ping; - return this->SendPacket (packet); + return SendPacket (packet); } int WorldSocket::iSendPacket (const WorldPacket& pct) diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp index a7558e354..9bb11f8fe 100644 --- a/src/game/WorldSocketMgr.cpp +++ b/src/game/WorldSocketMgr.cpp @@ -79,8 +79,8 @@ class ReactorRunnable : protected ACE_Task_Base virtual ~ReactorRunnable () { - this->Stop (); - this->Wait (); + Stop (); + Wait (); if (m_Reactor) delete m_Reactor; @@ -96,7 +96,7 @@ class ReactorRunnable : protected ACE_Task_Base if (m_ThreadId != -1) return -1; - return (m_ThreadId = this->activate ()); + return (m_ThreadId = activate ()); } void Wait () { ACE_Task_Base::wait (); } @@ -278,7 +278,7 @@ WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address) if (!sLog.IsOutDebug ()) ACE_Log_Msg::instance ()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS); - if (this->StartReactiveIO (port, address) == -1) + if (StartReactiveIO (port, address) == -1) return -1; return 0; @@ -301,7 +301,7 @@ WorldSocketMgr::StopNetwork () m_NetThreads[i].Stop (); } - this->Wait (); + Wait (); } void