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