From adc46ef9071f7e47058d375789155a4ab0b3d4b6 Mon Sep 17 00:00:00 2001 From: TheLuda Date: Wed, 15 Oct 2008 18:26:08 +0200 Subject: [PATCH] Applied new coding standard, see http://github.com/mangos/mangos/wikis/codingstandards for more. --- src/game/AccountMgr.cpp | 2 +- src/game/BattleGroundMgr.cpp | 2 +- src/game/Creature.cpp | 2 +- src/game/CreatureAISelector.cpp | 2 +- src/game/Level1.cpp | 4 +- src/game/Level2.cpp | 6 +- src/game/Makefile.am | 474 +++++++++++++-------------- src/game/NPCHandler.cpp | 2 +- src/game/Object.cpp | 2 +- src/game/ObjectMgr.cpp | 6 +- src/game/ObjectMgr.h | 4 +- src/game/Player.cpp | 6 +- src/game/RandomMovementGenerator.cpp | 2 +- src/game/SpellEffects.cpp | 2 +- src/game/Unit.cpp | 6 +- src/game/World.cpp | 14 +- src/game/World.h | 2 +- src/game/WorldSession.cpp | 10 +- src/game/WorldSession.h | 2 +- src/game/WorldSocket.cpp | 14 +- src/game/WorldSocket.h | 66 ++-- src/game/WorldSocketMgr.cpp | 20 +- src/game/WorldSocketMgr.h | 22 +- 23 files changed, 335 insertions(+), 337 deletions(-) diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index cacccc2ae..1221cf645 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -97,7 +97,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid) loginDatabase.BeginTransaction(); - bool res = + bool res = loginDatabase.PExecute("DELETE FROM account WHERE id='%d'", accid) && loginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid='%d'", accid); diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 7c0d8429a..5bd23ceef 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -102,7 +102,7 @@ void BattleGroundQueue::AddPlayer(Player *plr, uint32 bgTypeId) // Show queue status to player only (when joining queue) if(sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY)) { - ChatHandler(plr).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, + ChatHandler(plr).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level, qAlliance, MinPlayers - qAlliance, qHorde, MinPlayers - qHorde); } // System message diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 6664e62b5..34f7b1ee9 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1976,7 +1976,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); if((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount ) { - m_vendorItemCounts.erase(itr); + m_vendorItemCounts.erase(itr); return vItem->maxcount; } diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index acec57eaf..25a2cd184 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -53,7 +53,7 @@ namespace FactorySelector if(!ai_factory) { if( creature->isGuard() ) - ai_factory = ai_registry.GetRegistryItem("GuardAI"); + ai_factory = ai_registry.GetRegistryItem("GuardAI"); else if(creature->isPet() || creature->isCharmed()) ai_factory = ai_registry.GetRegistryItem("PetAI"); else if(creature->isTotem()) diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 11a1f415d..48be118b2 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -1882,13 +1882,13 @@ bool ChatHandler::HandleSendMailCommand(const char* args) // get from tail next item str while(char* itemStr = strtok(tail, " ")) { - // and get new tail + // and get new tail tail = strtok(NULL, ""); // parse item str char* itemIdStr = strtok(itemStr, ":"); char* itemCountStr = strtok(NULL, " "); - + uint32 item_id = atoi(itemIdStr); if(!item_id) return false; diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 83e626245..27369cd41 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -3912,7 +3912,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) { - + if(!*args) return false; @@ -3948,7 +3948,7 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) { - + if(!*args) return false; @@ -3978,7 +3978,7 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, int32 limit) Field* fields = result->Fetch(); uint32 acc_id = fields[0].GetUInt32(); std::string acc_name = fields[1].GetCppString(); - + QueryResult* chars = CharacterDatabase.PQuery("SELECT guid,name FROM characters WHERE account = '%u'", acc_id); if(chars) { diff --git a/src/game/Makefile.am b/src/game/Makefile.am index e8d24ddf7..65be340dc 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -28,243 +28,243 @@ noinst_LIBRARIES = libmangosgame.a # libmangossgame library will later be reused by ... libmangosgame_a_SOURCES = \ - AccountMgr.cpp \ - AccountMgr.h \ - AddonHandler.cpp \ - AddonHandler.h \ - AggressorAI.cpp \ - AggressorAI.h \ - AnimalRandomMovementGenerator.h \ - ArenaTeam.cpp \ - ArenaTeam.h \ - ArenaTeamHandler.cpp \ - AuctionHouse.cpp \ - AuctionHouseObject.h \ - Bag.cpp \ - Bag.h \ - BattleGround.cpp \ - BattleGroundAA.cpp \ - BattleGroundAB.cpp \ - BattleGroundAV.cpp \ - BattleGroundBE.cpp \ - BattleGroundEY.cpp \ - BattleGroundNA.cpp \ - BattleGroundRL.cpp \ - BattleGroundWS.cpp \ - BattleGround.h \ - BattleGroundAA.h \ - BattleGroundAB.h \ - BattleGroundAV.h \ - BattleGroundBE.h \ - BattleGroundEY.h \ - BattleGroundNA.h \ - BattleGroundRL.h \ - BattleGroundWS.h \ - BattleGroundHandler.cpp \ - BattleGroundMgr.cpp \ - BattleGroundMgr.h \ - Cell.h \ - CellImpl.h \ - Channel.cpp \ - Channel.h \ - ChannelHandler.cpp \ - ChannelMgr.h \ - CharacterHandler.cpp \ - Chat.cpp \ - Chat.h \ - ChatHandler.cpp \ - CombatHandler.cpp \ - ConfusedMovementGenerator.cpp \ - ConfusedMovementGenerator.h \ - Corpse.cpp \ - Corpse.h \ - CreatureAI.cpp \ - CreatureAI.h \ - CreatureAIImpl.h \ - CreatureAIRegistry.cpp \ - CreatureAIRegistry.h \ - CreatureAISelector.cpp \ - CreatureAISelector.h \ - Creature.cpp \ - Creature.h \ - debugcmds.cpp \ - DestinationHolder.cpp \ - DestinationHolder.h \ - DestinationHolderImp.h \ - DuelHandler.cpp \ - DynamicObject.cpp \ - DynamicObject.h \ - FleeingMovementGenerator.cpp \ - FleeingMovementGenerator.h \ - Formulas.h \ - GameEvent.cpp \ - GameEvent.h \ - GameObject.cpp \ - GameObject.h \ - GlobalEvents.cpp \ - GlobalEvents.h \ - GossipDef.cpp \ - GossipDef.h \ - GridDefines.h \ - GridNotifiers.cpp \ - GridNotifiers.h \ - GridNotifiersImpl.h \ - GridStates.cpp \ - GridStates.h \ - Group.cpp \ - Group.h \ - GroupHandler.cpp \ - GuardAI.cpp \ - GuardAI.h \ - Guild.cpp \ - Guild.h \ - GuildHandler.cpp \ - HateMatrix.h \ - HomeMovementGenerator.cpp \ - HomeMovementGenerator.h \ - HostilRefManager.cpp \ - HostilRefManager.h \ - IdleMovementGenerator.cpp \ - IdleMovementGenerator.h \ - InstanceData.cpp \ - InstanceData.h \ - InstanceSaveMgr.cpp \ - InstanceSaveMgr.h \ - Item.cpp \ - Item.h \ - ItemEnchantmentMgr.cpp \ - ItemEnchantmentMgr.h \ - ItemHandler.cpp \ - ItemPrototype.h \ - Language.h \ - Level0.cpp \ - Level1.cpp \ - Level2.cpp \ - Level3.cpp \ - LFGHandler.cpp \ - LootHandler.cpp \ - LootMgr.cpp \ - LootMgr.h \ - Mail.cpp \ - Mail.h \ - Map.cpp \ - Map.h \ - MapInstanced.cpp \ - MapInstanced.h \ - MapManager.cpp \ - MapManager.h \ - MiscHandler.cpp \ - MotionMaster.cpp \ - MotionMaster.h \ - MovementGenerator.cpp \ - MovementGenerator.h \ - MovementGeneratorImpl.h \ - MovementHandler.cpp \ - NPCHandler.cpp \ - NPCHandler.h \ - NullCreatureAI.cpp \ - NullCreatureAI.h \ - ObjectAccessor.cpp \ - ObjectAccessor.h \ - Object.cpp \ - ObjectDefines.h \ - ObjectGridLoader.cpp \ - ObjectGridLoader.h \ - Object.h \ - ObjectMgr.cpp \ - ObjectMgr.h \ - ObjectPosSelector.cpp \ - ObjectPosSelector.h \ - Opcodes.cpp \ - Opcodes.h \ - Path.h \ - PetAI.cpp \ - PetAI.h \ - Pet.cpp \ - Pet.h \ - PetHandler.cpp \ - PetitionsHandler.cpp \ - Player.cpp \ - Player.h \ - PlayerDump.cpp \ - PlayerDump.h \ - PointMovementGenerator.cpp \ - PointMovementGenerator.h \ - QueryHandler.cpp \ - QuestDef.cpp \ - QuestDef.h \ - QuestHandler.cpp \ - RandomMovementGenerator.cpp \ - RandomMovementGenerator.h \ - ReactorAI.cpp \ - ReactorAI.h \ - ScriptCalls.cpp \ - ScriptCalls.h \ - SharedDefines.h \ - SkillHandler.cpp \ - SpellAuraDefines.h \ - SpellAuras.cpp \ - SpellAuras.h \ - Spell.cpp \ - SpellEffects.cpp \ - Spell.h \ - SkillDiscovery.cpp \ - SkillDiscovery.h \ - SkillExtraItems.cpp \ - SkillExtraItems.h \ - SpellHandler.cpp \ - SocialMgr.cpp \ - SocialMgr.h \ - SpellMgr.cpp \ - SpellMgr.h \ - StatSystem.cpp \ - TargetedMovementGenerator.cpp \ - TargetedMovementGenerator.h \ - TaxiHandler.cpp \ - TemporarySummon.cpp \ - TemporarySummon.h \ - tools.cpp \ - Tools.h \ - TotemAI.cpp \ - TotemAI.h \ - Totem.cpp \ - Totem.h \ - TradeHandler.cpp \ - Transports.cpp \ - Transports.h \ - ThreatManager.cpp \ - ThreatManager.h \ - Traveller.h \ - Unit.cpp \ - Unit.h \ - UnitEvents.h \ - UpdateData.cpp \ - UpdateData.h \ - UpdateFields.h \ - UpdateMask.h \ - VoiceChatHandler.cpp \ - WaypointManager.cpp \ - WaypointManager.h \ - WaypointMovementGenerator.cpp \ - WaypointMovementGenerator.h \ - Weather.cpp \ - Weather.h \ - World.cpp \ - World.h \ - WorldLog.cpp \ - WorldLog.h \ - WorldSession.cpp \ - WorldSession.h \ - WorldSocket.cpp \ - WorldSocket.h \ - WorldSocketMgr.cpp \ - WorldSocketMgr.h \ - FollowerReference.cpp \ - FollowerReference.h \ - FollowerRefManager.h \ - GroupReference.cpp \ - GroupReference.h \ - GroupRefManager.h + AccountMgr.cpp \ + AccountMgr.h \ + AddonHandler.cpp \ + AddonHandler.h \ + AggressorAI.cpp \ + AggressorAI.h \ + AnimalRandomMovementGenerator.h \ + ArenaTeam.cpp \ + ArenaTeam.h \ + ArenaTeamHandler.cpp \ + AuctionHouse.cpp \ + AuctionHouseObject.h \ + Bag.cpp \ + Bag.h \ + BattleGround.cpp \ + BattleGroundAA.cpp \ + BattleGroundAB.cpp \ + BattleGroundAV.cpp \ + BattleGroundBE.cpp \ + BattleGroundEY.cpp \ + BattleGroundNA.cpp \ + BattleGroundRL.cpp \ + BattleGroundWS.cpp \ + BattleGround.h \ + BattleGroundAA.h \ + BattleGroundAB.h \ + BattleGroundAV.h \ + BattleGroundBE.h \ + BattleGroundEY.h \ + BattleGroundNA.h \ + BattleGroundRL.h \ + BattleGroundWS.h \ + BattleGroundHandler.cpp \ + BattleGroundMgr.cpp \ + BattleGroundMgr.h \ + Cell.h \ + CellImpl.h \ + Channel.cpp \ + Channel.h \ + ChannelHandler.cpp \ + ChannelMgr.h \ + CharacterHandler.cpp \ + Chat.cpp \ + Chat.h \ + ChatHandler.cpp \ + CombatHandler.cpp \ + ConfusedMovementGenerator.cpp \ + ConfusedMovementGenerator.h \ + Corpse.cpp \ + Corpse.h \ + CreatureAI.cpp \ + CreatureAI.h \ + CreatureAIImpl.h \ + CreatureAIRegistry.cpp \ + CreatureAIRegistry.h \ + CreatureAISelector.cpp \ + CreatureAISelector.h \ + Creature.cpp \ + Creature.h \ + debugcmds.cpp \ + DestinationHolder.cpp \ + DestinationHolder.h \ + DestinationHolderImp.h \ + DuelHandler.cpp \ + DynamicObject.cpp \ + DynamicObject.h \ + FleeingMovementGenerator.cpp \ + FleeingMovementGenerator.h \ + Formulas.h \ + GameEvent.cpp \ + GameEvent.h \ + GameObject.cpp \ + GameObject.h \ + GlobalEvents.cpp \ + GlobalEvents.h \ + GossipDef.cpp \ + GossipDef.h \ + GridDefines.h \ + GridNotifiers.cpp \ + GridNotifiers.h \ + GridNotifiersImpl.h \ + GridStates.cpp \ + GridStates.h \ + Group.cpp \ + Group.h \ + GroupHandler.cpp \ + GuardAI.cpp \ + GuardAI.h \ + Guild.cpp \ + Guild.h \ + GuildHandler.cpp \ + HateMatrix.h \ + HomeMovementGenerator.cpp \ + HomeMovementGenerator.h \ + HostilRefManager.cpp \ + HostilRefManager.h \ + IdleMovementGenerator.cpp \ + IdleMovementGenerator.h \ + InstanceData.cpp \ + InstanceData.h \ + InstanceSaveMgr.cpp \ + InstanceSaveMgr.h \ + Item.cpp \ + Item.h \ + ItemEnchantmentMgr.cpp \ + ItemEnchantmentMgr.h \ + ItemHandler.cpp \ + ItemPrototype.h \ + Language.h \ + Level0.cpp \ + Level1.cpp \ + Level2.cpp \ + Level3.cpp \ + LFGHandler.cpp \ + LootHandler.cpp \ + LootMgr.cpp \ + LootMgr.h \ + Mail.cpp \ + Mail.h \ + Map.cpp \ + Map.h \ + MapInstanced.cpp \ + MapInstanced.h \ + MapManager.cpp \ + MapManager.h \ + MiscHandler.cpp \ + MotionMaster.cpp \ + MotionMaster.h \ + MovementGenerator.cpp \ + MovementGenerator.h \ + MovementGeneratorImpl.h \ + MovementHandler.cpp \ + NPCHandler.cpp \ + NPCHandler.h \ + NullCreatureAI.cpp \ + NullCreatureAI.h \ + ObjectAccessor.cpp \ + ObjectAccessor.h \ + Object.cpp \ + ObjectDefines.h \ + ObjectGridLoader.cpp \ + ObjectGridLoader.h \ + Object.h \ + ObjectMgr.cpp \ + ObjectMgr.h \ + ObjectPosSelector.cpp \ + ObjectPosSelector.h \ + Opcodes.cpp \ + Opcodes.h \ + Path.h \ + PetAI.cpp \ + PetAI.h \ + Pet.cpp \ + Pet.h \ + PetHandler.cpp \ + PetitionsHandler.cpp \ + Player.cpp \ + Player.h \ + PlayerDump.cpp \ + PlayerDump.h \ + PointMovementGenerator.cpp \ + PointMovementGenerator.h \ + QueryHandler.cpp \ + QuestDef.cpp \ + QuestDef.h \ + QuestHandler.cpp \ + RandomMovementGenerator.cpp \ + RandomMovementGenerator.h \ + ReactorAI.cpp \ + ReactorAI.h \ + ScriptCalls.cpp \ + ScriptCalls.h \ + SharedDefines.h \ + SkillHandler.cpp \ + SpellAuraDefines.h \ + SpellAuras.cpp \ + SpellAuras.h \ + Spell.cpp \ + SpellEffects.cpp \ + Spell.h \ + SkillDiscovery.cpp \ + SkillDiscovery.h \ + SkillExtraItems.cpp \ + SkillExtraItems.h \ + SpellHandler.cpp \ + SocialMgr.cpp \ + SocialMgr.h \ + SpellMgr.cpp \ + SpellMgr.h \ + StatSystem.cpp \ + TargetedMovementGenerator.cpp \ + TargetedMovementGenerator.h \ + TaxiHandler.cpp \ + TemporarySummon.cpp \ + TemporarySummon.h \ + tools.cpp \ + Tools.h \ + TotemAI.cpp \ + TotemAI.h \ + Totem.cpp \ + Totem.h \ + TradeHandler.cpp \ + Transports.cpp \ + Transports.h \ + ThreatManager.cpp \ + ThreatManager.h \ + Traveller.h \ + Unit.cpp \ + Unit.h \ + UnitEvents.h \ + UpdateData.cpp \ + UpdateData.h \ + UpdateFields.h \ + UpdateMask.h \ + VoiceChatHandler.cpp \ + WaypointManager.cpp \ + WaypointManager.h \ + WaypointMovementGenerator.cpp \ + WaypointMovementGenerator.h \ + Weather.cpp \ + Weather.h \ + World.cpp \ + World.h \ + WorldLog.cpp \ + WorldLog.h \ + WorldSession.cpp \ + WorldSession.h \ + WorldSocket.cpp \ + WorldSocket.h \ + WorldSocketMgr.cpp \ + WorldSocketMgr.h \ + FollowerReference.cpp \ + FollowerReference.h \ + FollowerRefManager.h \ + GroupReference.cpp \ + GroupReference.h \ + GroupRefManager.h ## Link against shared library libmangosgame_a_LIBADD = ../shared/libmangosshared.a ../shared/Auth/libmangosauth.a ../shared/Config/libmangosconfig.a ../shared/Database/libmangosdatabase.a ../shared/vmap/libmangosvmaps.a diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 40d486c35..2fd973610 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -219,7 +219,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) // check present spell in trainer spell list TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); if(!trainer_spells) - return; + return; // not found, cheat? TrainerSpell const* trainer_spell = trainer_spells->Find(spellId); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 71bc3fa35..0b6bb2092 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1172,7 +1172,7 @@ namespace MaNGOS { public: MessageChatLocaleCacheDo(WorldObject const& obj, ChatMsg msgtype, int32 textId, uint32 language, uint64 targetGUID, float dist) - : i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(language), + : i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(language), i_targetGUID(targetGUID), i_dist(dist) { } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index b90c5146b..8b018d0ec 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -6650,7 +6650,7 @@ bool ObjectMgr::AddGameTele(GameTele& tele) for(GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr) if(itr->first > new_id) new_id = itr->first; - + // use next ++new_id; @@ -6690,7 +6690,7 @@ bool ObjectMgr::DeleteGameTele(std::string name) void ObjectMgr::LoadTrainerSpell() { - // For reload case + // For reload case for (CacheTrainerSpellMap::iterator itr = m_mCacheTrainerSpellMap.begin(); itr != m_mCacheTrainerSpellMap.end(); ++itr) itr->second.Clear(); m_mCacheTrainerSpellMap.clear(); @@ -6781,7 +6781,7 @@ void ObjectMgr::LoadTrainerSpell() void ObjectMgr::LoadVendors() { - // For reload case + // For reload case for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr) itr->second.Clear(); m_mCacheVendorItemMap.clear(); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index fbb41cf5d..2b7072524 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2005-2008 MaNGOS * * This program is free software; you can redistribute it and/or modify @@ -716,7 +716,7 @@ class ObjectMgr CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry); if(iter == m_mCacheNpcTextIdMap.end()) return 0; - + return iter->second; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8de8daaca..872bafa28 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -265,7 +265,7 @@ Player::Player (WorldSession *session): Unit() if(GetSession()->GetSecurity() >= SEC_GAMEMASTER) SetAcceptTicket(true); - // players always accept + // players always accept if(GetSession()->GetSecurity() == SEC_PLAYER) SetAcceptWhispers(true); @@ -18134,7 +18134,7 @@ void Player::UpdateUnderwaterState( Map* m, float x, float y, float z ) void Player::SetCanParry( bool value ) { if(m_canParry==value) - return; + return; m_canParry = value; UpdateParryPercentage(); @@ -18143,7 +18143,7 @@ void Player::SetCanParry( bool value ) void Player::SetCanBlock( bool value ) { if(m_canBlock==value) - return; + return; m_canBlock = value; UpdateBlockPercentage(); diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp index 10f54e9c6..a46d3af2b 100644 --- a/src/game/RandomMovementGenerator.cpp +++ b/src/game/RandomMovementGenerator.cpp @@ -50,7 +50,7 @@ RandomMovementGenerator::_setRandomLocation(Creature &creature) nx = X + distanceX; ny = Y + distanceY; - // prevent invalid coordinates generation + // prevent invalid coordinates generation MaNGOS::NormalizeMapCoord(nx); MaNGOS::NormalizeMapCoord(ny); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 4f702da94..614d6d2f3 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1177,7 +1177,7 @@ void Spell::EffectDummy(uint32 i) { //Polymorph Cast Visual Rank 1 const uint32 spell_list[6] = {32813, 32816, 32817, 32818, 32819, 32820}; - unitTarget->CastSpell( unitTarget, spell_list[urand(0, 5)], true); + unitTarget->CastSpell( unitTarget, spell_list[urand(0, 5)], true); } return; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9343f6606..18e2bdfe8 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7477,7 +7477,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 CastingTime = 0; } // Holy Nova - 14% - else if ((spellProto->SpellFamilyFlags & 0x400000LL) && spellProto->SpellIconID == 1874) + else if ((spellProto->SpellFamilyFlags & 0x400000LL) && spellProto->SpellIconID == 1874) { CastingTime = 500; } @@ -7817,7 +7817,7 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, break; case SPELLFAMILY_PRIEST: // Holy Nova - 14% - if ((spellProto->SpellFamilyFlags & 0x8000000LL) && spellProto->SpellIconID == 1874) + if ((spellProto->SpellFamilyFlags & 0x8000000LL) && spellProto->SpellIconID == 1874) CastingTime = 500; break; case SPELLFAMILY_PALADIN: @@ -8573,7 +8573,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList) // raw invisibility bool invisible = (m_invisibilityMask != 0 || u->m_invisibilityMask !=0); - + // detectable invisibility case if( invisible && ( // Invisible units, always are visible for units under same invisibility type diff --git a/src/game/World.cpp b/src/game/World.cpp index 708525f83..54d5eaf0a 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -123,7 +123,7 @@ World::~World() VMAP::VMapFactory::clear(); if(m_resultQueue) delete m_resultQueue; - + //TODO free addSessQueue } @@ -208,7 +208,7 @@ World::AddSession_ (WorldSession* s) uint32 pLimit = GetPlayerAmountLimit (); uint32 QueueSize = GetQueueSize (); //number of players in the queue bool inQueue = false; - //so we don't count the user trying to + //so we don't count the user trying to //login as a session and queue the socket that we are using --Sessions; @@ -219,7 +219,7 @@ World::AddSession_ (WorldSession* s) sLog.outDetail ("PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId (), ++QueueSize); return; } - + WorldPacket packet(SMSG_AUTH_RESPONSE, 1 + 4 + 1 + 4 + 1); packet << uint8 (AUTH_OK); packet << uint32 (0); // unknown random value... @@ -255,7 +255,7 @@ int32 World::GetQueuePos(WorldSession* sess) void World::AddQueuedPlayer(WorldSession* sess) { m_QueuedPlayer.push_back (sess); - + // The 1st SMSG_AUTH_RESPONSE needs to contain other info too. WorldPacket packet (SMSG_AUTH_RESPONSE, 1 + 4 + 1 + 4 + 1); packet << uint8 (AUTH_WAIT_QUEUE); @@ -265,7 +265,7 @@ void World::AddQueuedPlayer(WorldSession* sess) packet << uint8 (sess->Expansion()); // 0 - normal, 1 - TBC, must be set in database manually for each account packet << uint32(GetQueuePos (sess)); sess->SendPacket (&packet); - + //sess->SendAuthWaitQue (GetQueuePos (sess)); } @@ -787,7 +787,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_THREAT_RADIUS] = sConfig.GetIntDefault("ThreatRadius", 100); // always use declined names in the russian client - m_configs[CONFIG_DECLINED_NAMES_USED] = + m_configs[CONFIG_DECLINED_NAMES_USED] = (m_configs[CONFIG_REALM_ZONE] == REALM_ZONE_RUSSIAN) ? true : sConfig.GetBoolDefault("DeclinedNames", false); m_configs[CONFIG_LISTEN_RANGE_SAY] = sConfig.GetIntDefault("ListenRange.Say", 25); @@ -2429,7 +2429,7 @@ void World::UpdateSessions( time_t diff ) WorldSession* sess = addSessQueue.next (); AddSession_ (sess); } - + ///- Delete kicked sessions at add new session for (std::set::iterator itr = m_kicked_sessions.begin(); itr != m_kicked_sessions.end(); ++itr) delete *itr; diff --git a/src/game/World.h b/src/game/World.h index 74a3a5e53..ad6d4dc2e 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -527,7 +527,7 @@ class World //Player Queue Queue m_QueuedPlayer; - + //sessions that are added async void AddSession_(WorldSession* s); ZThread::LockedQueue addSessQueue; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index d448bdff2..8844c6f6a 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -64,7 +64,7 @@ WorldSession::~WorldSession() /// - If have unclosed socket, close it if (m_Socket) { - m_Socket->CloseSocket (); + m_Socket->CloseSocket (); m_Socket->RemoveReference (); m_Socket = NULL; } @@ -75,7 +75,7 @@ WorldSession::~WorldSession() WorldPacket *packet = _recvQueue.next(); delete packet; } - + sWorld.RemoveQueuedPlayer(this); } @@ -156,11 +156,11 @@ bool WorldSession::Update(uint32 /*diff*/) { if (m_Socket) if (m_Socket->IsClosed ()) - { + { m_Socket->RemoveReference (); m_Socket = NULL; } - + WorldPacket *packet; ///- Retrieve packets from the receive queue and call the appropriate handlers @@ -507,5 +507,3 @@ void WorldSession::SendAuthWaitQue(uint32 position) SendPacket(&packet); } } - - diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 45b6bed27..6ca124266 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -115,7 +115,7 @@ class MANGOS_DLL_SPEC WorldSession void QueuePacket(WorldPacket* new_packet); bool Update(uint32 diff); - + /// Handle the authentication waiting queue (to be completed) void SendAuthWaitQue(uint32 position); diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 4189d84be..a240b41b3 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2005-2008 MaNGOS * * This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ */ #include "Common.h" -#include "WorldSocket.h" +#include "WorldSocket.h" #include #include #include @@ -301,7 +301,7 @@ int WorldSocket::handle_output (ACE_HANDLE) #else ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len); #endif // MSG_NOSIGNAL - + if (n == 0) return -1; else if (n == -1) @@ -402,7 +402,7 @@ int WorldSocket::handle_input_header (void) if(header.size > 0) { - m_RecvWPct->resize (header.size); + m_RecvWPct->resize (header.size); m_RecvPct.base ((char*) m_RecvWPct->contents (), m_RecvWPct->size ()); } else @@ -567,7 +567,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g) int WorldSocket::ProcessIncoming (WorldPacket* new_pct) { ACE_ASSERT (new_pct); - + // manage memory ;) ACE_Auto_Ptr aptr (new_pct); @@ -799,7 +799,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) delete result; - // Re-check account ban (same check as in realmd) + // Re-check account ban (same check as in realmd) QueryResult *banresult = loginDatabase.PQuery ("SELECT " "bandate, " @@ -977,7 +977,7 @@ int WorldSocket::iSendPacket (const WorldPacket& pct) #if ACE_BYTE_ORDER == ACE_BIG_ENDIAN header.cmd = ACE_SWAP_WORD (header.cmd) #endif - + header.size = (uint16) pct.size () + 2; header.size = ACE_HTONS (header.size); diff --git a/src/game/WorldSocket.h b/src/game/WorldSocket.h index afce966d8..729670352 100644 --- a/src/game/WorldSocket.h +++ b/src/game/WorldSocket.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2005-2008 MaNGOS * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ */ #ifndef _WORLDSOCKET_H -#define _WORLDSOCKET_H +#define _WORLDSOCKET_H #include #include @@ -41,7 +41,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Common.h" -#include "Auth/AuthCrypt.h" +#include "Auth/AuthCrypt.h" class ACE_Message_Block; class WorldPacket; @@ -52,39 +52,39 @@ typedef ACE_Svc_Handler WorldHandler; /** * WorldSocket. - * - * This class is responsible for the comunication with + * + * This class is responsible for the comunication with * remote clients. - * Most methods return -1 on failure. + * Most methods return -1 on failure. * The class uses refferece counting. * - * For output the class uses one buffer (64K usually) and - * a queue where it stores packet if there is no place on - * the queue. The reason this is done, is because the server - * does realy a lot of small-size writes to it, and it doesn't - * scale well to allocate memory for every. When something is - * writen to the output buffer the socket is not immideately - * activated for output (again for the same reason), there - * is 10ms celling (thats why there is Update() method). - * This concept is simmilar to TCP_CORK, but TCP_CORK - * usses 200ms celling. As result overhead generated by - * sending packets from "producer" threads is minimal, + * For output the class uses one buffer (64K usually) and + * a queue where it stores packet if there is no place on + * the queue. The reason this is done, is because the server + * does realy a lot of small-size writes to it, and it doesn't + * scale well to allocate memory for every. When something is + * writen to the output buffer the socket is not immideately + * activated for output (again for the same reason), there + * is 10ms celling (thats why there is Update() method). + * This concept is simmilar to TCP_CORK, but TCP_CORK + * usses 200ms celling. As result overhead generated by + * sending packets from "producer" threads is minimal, * and doing a lot of writes with small size is tollerated. - * + * * The calls to Upate () method are managed by WorldSocketMgr * and ReactorRunnable. - * - * For input ,the class uses one 1024 bytes buffer on stack - * to which it does recv() calls. And then recieved data is - * distributed where its needed. 1024 matches pritey well the + * + * For input ,the class uses one 1024 bytes buffer on stack + * to which it does recv() calls. And then recieved data is + * distributed where its needed. 1024 matches pritey well the * traffic generated by client for now. - * - * The input/output do speculative reads/writes (AKA it tryes - * to read all data avaible in the kernel buffer or tryes to - * write everything avaible in userspace buffer), - * which is ok for using with Level and Edge Trigered IO + * + * The input/output do speculative reads/writes (AKA it tryes + * to read all data avaible in the kernel buffer or tryes to + * write everything avaible in userspace buffer), + * which is ok for using with Level and Edge Trigered IO * notification. - * + * */ class WorldSocket : protected WorldHandler { @@ -160,7 +160,7 @@ private: int schedule_wakeup_output (GuardType& g); /// process one incoming packet. - /// @param new_pct received packet ,note that you need to delete it. + /// @param new_pct received packet ,note that you need to delete it. int ProcessIncoming (WorldPacket* new_pct); /// Called by ProcessIncoming() on CMSG_AUTH_SESSION. @@ -175,14 +175,14 @@ private: /// Flush m_PacketQueue if there are packets in it /// Need to be called with m_OutBufferLock lock held - /// @return true if it wrote to the buffer ( AKA you need + /// @return true if it wrote to the buffer ( AKA you need /// to mark the socket for output ). bool iFlushPacketQueue (); private: /// Time in which the last ping was received ACE_Time_Value m_LastPingTime; - + /// Keep track of overspeed pings ,to prevent ping flood. uint32 m_OverSpeedPings; @@ -202,7 +202,7 @@ private: WorldPacket* m_RecvWPct; /// This block actually refers to m_RecvWPct contents, - /// which alows easy and safe writing to it. + /// which alows easy and safe writing to it. /// It wont free memory when its deleted. m_RecvWPct takes care of freeing. ACE_Message_Block m_RecvPct; @@ -228,6 +228,6 @@ private: uint32 m_Seed; }; -#endif /* _WORLDSOCKET_H */ +#endif /* _WORLDSOCKET_H */ /// @} diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp index 341030c6d..3324330ea 100644 --- a/src/game/WorldSocketMgr.cpp +++ b/src/game/WorldSocketMgr.cpp @@ -44,8 +44,8 @@ #include "Database/DatabaseEnv.h" #include "WorldSocket.h" -/** - * This is a helper class to WorldSocketMgr ,that manages +/** + * This is a helper class to WorldSocketMgr ,that manages * network threads, and assigning connections from acceptor thread * to other network threads */ @@ -122,14 +122,14 @@ public: return 0; } - + ACE_Reactor* GetReactor () { return m_Reactor; } - + protected: - + void AddNewSockets () { @@ -167,7 +167,7 @@ protected: while (!m_Reactor->reactor_event_loop_done ()) { - // dont be too smart to move this outside the loop + // dont be too smart to move this outside the loop // the run_reactor_event_loop will modify interval ACE_Time_Value interval (0, 10000); @@ -227,7 +227,7 @@ WorldSocketMgr::~WorldSocketMgr () { if (m_NetThreads) delete [] m_NetThreads; - + if(m_Acceptor) delete m_Acceptor; } @@ -306,11 +306,11 @@ WorldSocketMgr::StopNetwork () for (size_t i = 0; i < m_NetThreadsCount; ++i) m_NetThreads[i].Stop (); } - + this->Wait (); } -void +void WorldSocketMgr::Wait () { if (m_NetThreadsCount != 0) @@ -346,7 +346,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) sLog.outError ("WorldSocketMgr::OnSocketOpen: peer ().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); return -1; } - + sock->m_OutBufferSize = static_cast (m_SockOutUBuff); // we skip the Acceptor Thread diff --git a/src/game/WorldSocketMgr.h b/src/game/WorldSocketMgr.h index 07595c820..70ab1a0a0 100644 --- a/src/game/WorldSocketMgr.h +++ b/src/game/WorldSocketMgr.h @@ -34,7 +34,7 @@ class ReactorRunnable; class ACE_Event_Handler; /// Manages all sockets connected to peers and network threads -class WorldSocketMgr +class WorldSocketMgr { public: friend class WorldSocket; @@ -42,32 +42,32 @@ public: /// Start network, listen at address:port . int StartNetwork (ACE_UINT16 port, const char* address); - + /// Stops all network threads, It will wait for all running threads . void StopNetwork (); - + /// Wait untill all network threads have "joined" . void Wait (); - + /// Make this class singleton . static WorldSocketMgr* Instance (); - + private: int OnSocketOpen(WorldSocket* sock); - + int StartReactiveIO(ACE_UINT16 port, const char* address); - -private: + +private: WorldSocketMgr (); virtual ~WorldSocketMgr (); - + ReactorRunnable* m_NetThreads; size_t m_NetThreadsCount; - + int m_SockOutKBuff; int m_SockOutUBuff; bool m_UseNoDelay; - + ACE_Event_Handler* m_Acceptor; };