This commit is contained in:
TheLuda 2008-10-15 18:26:08 +02:00
parent 5d294f0ad2
commit adc46ef907
23 changed files with 335 additions and 337 deletions

View file

@ -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);

View file

@ -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

View file

@ -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;
}

View file

@ -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())

View file

@ -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;

View file

@ -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)
{

View file

@ -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

View file

@ -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);

View file

@ -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)
{
}

View file

@ -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();

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* 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;
}

View file

@ -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();

View file

@ -50,7 +50,7 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
nx = X + distanceX;
ny = Y + distanceY;
// prevent invalid coordinates generation
// prevent invalid coordinates generation
MaNGOS::NormalizeMapCoord(nx);
MaNGOS::NormalizeMapCoord(ny);

View file

@ -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;
}

View file

@ -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

View file

@ -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<WorldSession*>::iterator itr = m_kicked_sessions.begin(); itr != m_kicked_sessions.end(); ++itr)
delete *itr;

View file

@ -527,7 +527,7 @@ class World
//Player Queue
Queue m_QueuedPlayer;
//sessions that are added async
void AddSession_(WorldSession* s);
ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue;

View file

@ -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);
}
}

View file

@ -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);

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* 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 <ace/Message_Block.h>
#include <ace/OS_NS_string.h>
#include <ace/OS_NS_unistd.h>
@ -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<WorldPacket> 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);

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* 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 <ace/Basic_Types.h>
#include <ace/Synch_Traits.h>
@ -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<ACE_SOCK_STREAM, ACE_NULL_SYNCH> 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 */
/// @}

View file

@ -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<size_t> (m_SockOutUBuff);
// we skip the Acceptor Thread

View file

@ -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;
};