Core/Misc: Code style and remove unused define.

Signed-off-by: Gyx <[email protected]>
This commit is contained in:
Gyx
2012-03-29 14:43:34 +08:00
parent e77f51df5d
commit 5b7493fc66
21 changed files with 86 additions and 88 deletions
@@ -795,7 +795,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
AuctionEntry* auction = new AuctionEntry(); AuctionEntry* auction = new AuctionEntry();
// Can't use LoadFromDB() because it assumes the auction map is loaded // Can't use LoadFromDB() because it assumes the auction map is loaded
if (!auction->LoadFromFieldList(fields)) if (!auction->LoadFromFieldList(fields))
{ {
// For some reason the record in the DB is broken (possibly corrupt // For some reason the record in the DB is broken (possibly corrupt
@@ -306,11 +306,13 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
{ {
// Remove member from team // Remove member from team
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
if (itr->Guid == guid) if (itr->Guid == guid)
{ {
Members.erase(itr); Members.erase(itr);
break; break;
} }
}
// Inform player and remove arena team info from player data // Inform player and remove arena team info from player data
if (Player* player = ObjectAccessor::FindPlayer(guid)) if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -75,9 +75,9 @@ void ObjectPosSelector::InitializeAngle()
bool ObjectPosSelector::FirstAngle(float& angle) bool ObjectPosSelector::FirstAngle(float& angle)
{ {
if (m_UsedPosLists[USED_POS_PLUS].empty() && !m_UsedPosLists[USED_POS_MINUS].empty() ) if (m_UsedPosLists[USED_POS_PLUS].empty() && !m_UsedPosLists[USED_POS_MINUS].empty())
return NextAngleFor(*m_UsedPosLists[USED_POS_MINUS].begin(), 1.0f, USED_POS_PLUS, angle); return NextAngleFor(*m_UsedPosLists[USED_POS_MINUS].begin(), 1.0f, USED_POS_PLUS, angle);
else if (m_UsedPosLists[USED_POS_MINUS].empty() && !m_UsedPosLists[USED_POS_PLUS].empty() ) else if (m_UsedPosLists[USED_POS_MINUS].empty() && !m_UsedPosLists[USED_POS_PLUS].empty())
return NextAngleFor(*m_UsedPosLists[USED_POS_PLUS].begin(), -1.0f, USED_POS_MINUS, angle); return NextAngleFor(*m_UsedPosLists[USED_POS_PLUS].begin(), -1.0f, USED_POS_MINUS, angle);
return false; return false;
@@ -100,7 +100,7 @@ bool ObjectPosSelector::NextAngle(float& angle)
bool ObjectPosSelector::NextUsedAngle(float& angle) bool ObjectPosSelector::NextUsedAngle(float& angle)
{ {
while (m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() || while (m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() ||
m_nextUsedPos[USED_POS_MINUS]!=m_UsedPosLists[USED_POS_MINUS].end() ) m_nextUsedPos[USED_POS_MINUS]!=m_UsedPosLists[USED_POS_MINUS].end())
{ {
// calculate next possible angle // calculate next possible angle
if (!NextPosibleAngle(angle)) if (!NextPosibleAngle(angle))
@@ -114,7 +114,7 @@ bool ObjectPosSelector::NextPosibleAngle(float& angle)
{ {
// ++ direction less updated // ++ direction less updated
if (m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() && if (m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() &&
(m_nextUsedPos[USED_POS_MINUS]==m_UsedPosLists[USED_POS_MINUS].end() || m_nextUsedPos[USED_POS_PLUS]->first <= m_nextUsedPos[USED_POS_MINUS]->first) ) (m_nextUsedPos[USED_POS_MINUS]==m_UsedPosLists[USED_POS_MINUS].end() || m_nextUsedPos[USED_POS_PLUS]->first <= m_nextUsedPos[USED_POS_MINUS]->first))
{ {
bool ok; bool ok;
if (m_smallStepOk[USED_POS_PLUS]) if (m_smallStepOk[USED_POS_PLUS])
+1 -1
View File
@@ -20475,7 +20475,7 @@ void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask)
{ {
WorldPacket data(SMSG_SET_PROFICIENCY, 1 + 4); WorldPacket data(SMSG_SET_PROFICIENCY, 1 + 4);
data << uint8(itemClass) << uint32(itemSubclassMask); data << uint8(itemClass) << uint32(itemSubclassMask);
GetSession()->SendPacket (&data); GetSession()->SendPacket(&data);
} }
void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
+2 -2
View File
@@ -9020,10 +9020,10 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 70893: case 70893:
{ {
// check if we're doing a critical hit // check if we're doing a critical hit
if (!(procSpell->SpellFamilyFlags[1] & 0x10000000) && (procEx != PROC_EX_CRITICAL_HIT) ) if (!(procSpell->SpellFamilyFlags[1] & 0x10000000) && (procEx != PROC_EX_CRITICAL_HIT))
return false; return false;
// check if we're procced by Claw, Bite or Smack (need to use the spell icon ID to detect it) // check if we're procced by Claw, Bite or Smack (need to use the spell icon ID to detect it)
if (!(procSpell->SpellIconID == 262 || procSpell->SpellIconID == 1680 || procSpell->SpellIconID == 473 )) if (!(procSpell->SpellIconID == 262 || procSpell->SpellIconID == 1680 || procSpell->SpellIconID == 473))
return false; return false;
break; break;
} }
+1 -1
View File
@@ -756,7 +756,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p,
if (!p || !p->GetSession()) if (!p || !p->GetSession())
return; return;
WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1 )); WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
data << uint64(r.itemGUID); // guid of rolled item data << uint64(r.itemGUID); // guid of rolled item
data << uint32(mapId); // 3.3.3 mapid data << uint32(mapId); // 3.3.3 mapid
data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it??? data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it???
@@ -1673,7 +1673,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
{ {
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
data << uint8(CHAR_NAME_RESERVED); data << uint8(CHAR_NAME_RESERVED);
SendPacket (&data); SendPacket(&data);
return; return;
} }
@@ -173,12 +173,6 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
} }
} }
#define OPEN_CHEST 11437
#define OPEN_SAFE 11535
#define OPEN_CAGE 11792
#define OPEN_BOOTY_CHEST 5107
#define OPEN_STRONGBOX 8517
void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
{ {
sLog->outDetail("WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); sLog->outDetail("WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size());
+1 -1
View File
@@ -2355,7 +2355,7 @@ bool InstanceMap::CanEnter(Player* player)
return false; return false;
} }
// player inside instance has no group or his groups is different to entering player's one, deny entry // player inside instance has no group or his groups is different to entering player's one, deny entry
if (!iPlayer->GetGroup() || iPlayer->GetGroup() != player->GetGroup() ) if (!iPlayer->GetGroup() || iPlayer->GetGroup() != player->GetGroup())
{ {
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
return false; return false;
+2 -2
View File
@@ -202,11 +202,11 @@ void MotionMaster::MoveTargetedHome()
} }
else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID()) else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID())
{ {
sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow() ); sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow());
Unit *target = ((Creature*)_owner)->GetCharmerOrOwner(); Unit *target = ((Creature*)_owner)->GetCharmerOrOwner();
if (target) if (target)
{ {
sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() ); sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow());
Mutate(new FollowMovementGenerator<Creature>(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE); Mutate(new FollowMovementGenerator<Creature>(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE);
} }
} }
@@ -118,7 +118,7 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{ {
// waiting for next move // waiting for next move
i_nextMoveTime.Update(diff); i_nextMoveTime.Update(diff);
if(i_nextMoveTime.Passed() ) if (i_nextMoveTime.Passed())
{ {
// start moving // start moving
unit.AddUnitState(UNIT_STATE_CONFUSED_MOVE); unit.AddUnitState(UNIT_STATE_CONFUSED_MOVE);
@@ -182,7 +182,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
} }
} }
i_to_distance_from_caster = 0.0f; i_to_distance_from_caster = 0.0f;
i_nextCheckTime.Reset( urand(500,1000) ); i_nextCheckTime.Reset(urand(500,1000));
return false; return false;
} }
@@ -201,12 +201,12 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
(i_last_distance_from_caster < i_to_distance_from_caster && cur_dist_xyz > i_to_distance_from_caster) || (i_last_distance_from_caster < i_to_distance_from_caster && cur_dist_xyz > i_to_distance_from_caster) ||
// if we reach bigger distance // if we reach bigger distance
(cur_dist_xyz > MAX_QUIET_DISTANCE) || // if we are too far (cur_dist_xyz > MAX_QUIET_DISTANCE) || // if we are too far
(i_last_distance_from_caster > MIN_QUIET_DISTANCE && cur_dist_xyz < MIN_QUIET_DISTANCE) ) (i_last_distance_from_caster > MIN_QUIET_DISTANCE && cur_dist_xyz < MIN_QUIET_DISTANCE))
// if we leave 'quiet zone' // if we leave 'quiet zone'
{ {
// we are very far or too close, stopping // we are very far or too close, stopping
i_to_distance_from_caster = 0.0f; i_to_distance_from_caster = 0.0f;
i_nextCheckTime.Reset( urand(500,1000) ); i_nextCheckTime.Reset(urand(500,1000));
return false; return false;
} }
else else
@@ -231,7 +231,7 @@ void FlightPathMovementGenerator::Reset(Player & player)
uint32 end = GetPathAtMapEnd(); uint32 end = GetPathAtMapEnd();
for (uint32 i = GetCurrentNode(); i != end; ++i) for (uint32 i = GetCurrentNode(); i != end; ++i)
{ {
G3D::Vector3 vertice((*i_path)[i].x,(*i_path)[i].y,(*i_path)[i].z); G3D::Vector3 vertice((*i_path)[i].x, (*i_path)[i].y, (*i_path)[i].z);
init.Path().push_back(vertice); init.Path().push_back(vertice);
} }
init.SetFirstPointId(GetCurrentNode()); init.SetFirstPointId(GetCurrentNode());
@@ -34,6 +34,7 @@ WorldLog::~WorldLog()
{ {
if (i_file != NULL) if (i_file != NULL)
fclose(i_file); fclose(i_file);
i_file = NULL; i_file = NULL;
} }
+2 -1
View File
@@ -195,7 +195,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
} }
#endif // !TRINITY_DEBUG #endif // !TRINITY_DEBUG
if (m_Socket->SendPacket (*packet) == -1) if (m_Socket->SendPacket(*packet) == -1)
m_Socket->CloseSocket(); m_Socket->CloseSocket();
} }
@@ -922,6 +922,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
{ {
if (data.rpos() + 4 > data.size()) if (data.rpos() + 4 > data.size())
return; return;
uint32 size; uint32 size;
data >> size; data >> size;
+22 -22
View File
@@ -152,7 +152,7 @@ const std::string& WorldSocket::GetRemoteAddress (void) const
return m_Address; return m_Address;
} }
int WorldSocket::SendPacket (const WorldPacket& pct) int WorldSocket::SendPacket(const WorldPacket& pct)
{ {
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
@@ -252,7 +252,7 @@ int WorldSocket::open (void *a)
if (peer().get_remote_addr(remote_addr) == -1) if (peer().get_remote_addr(remote_addr) == -1)
{ {
sLog->outError ("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); sLog->outError("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1; return -1;
} }
@@ -277,7 +277,7 @@ int WorldSocket::open (void *a)
// Register with ACE Reactor // Register with ACE Reactor
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{ {
sLog->outError ("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); sLog->outError("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1; return -1;
} }
@@ -496,7 +496,7 @@ int WorldSocket::handle_input_header (void)
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240)) if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
{ {
Player* _player = m_Session ? m_Session->GetPlayer() : NULL; Player* _player = m_Session ? m_Session->GetPlayer() : NULL;
sLog->outError ("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
m_Session ? m_Session->GetAccountId() : 0, m_Session ? m_Session->GetAccountId() : 0,
_player ? _player->GetGUIDLow() : 0, _player ? _player->GetGUIDLow() : 0,
_player ? _player->GetName() : "<none>", _player ? _player->GetName() : "<none>",
@@ -602,7 +602,7 @@ int WorldSocket::handle_input_missing_data (void)
// hope this is not hack, as proper m_RecvWPct is asserted around // hope this is not hack, as proper m_RecvWPct is asserted around
if (!m_RecvWPct) if (!m_RecvWPct)
{ {
sLog->outError ("Forcing close on input m_RecvWPct = NULL"); sLog->outError("Forcing close on input m_RecvWPct = NULL");
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
@@ -648,7 +648,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g)
(this, ACE_Event_Handler::WRITE_MASK) == -1) (this, ACE_Event_Handler::WRITE_MASK) == -1)
{ {
// would be good to store errno from reactor with errno guard // would be good to store errno from reactor with errno guard
sLog->outError ("WorldSocket::cancel_wakeup_output"); sLog->outError("WorldSocket::cancel_wakeup_output");
return -1; return -1;
} }
@@ -667,7 +667,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g)
if (reactor()->schedule_wakeup if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1) (this, ACE_Event_Handler::WRITE_MASK) == -1)
{ {
sLog->outError ("WorldSocket::schedule_wakeup_output"); sLog->outError("WorldSocket::schedule_wakeup_output");
return -1; return -1;
} }
@@ -715,7 +715,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
case CMSG_AUTH_SESSION: case CMSG_AUTH_SESSION:
if (m_Session) if (m_Session)
{ {
sLog->outError ("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again"); sLog->outError("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
return -1; return -1;
} }
@@ -744,7 +744,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
} }
else else
{ {
sLog->outError ("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); sLog->outError("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
return -1; return -1;
} }
} }
@@ -788,9 +788,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{ {
packet.Initialize(SMSG_AUTH_RESPONSE, 1); packet.Initialize(SMSG_AUTH_RESPONSE, 1);
packet << uint8(AUTH_REJECT); packet << uint8(AUTH_REJECT);
SendPacket (packet); SendPacket(packet);
sLog->outError ("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
return -1; return -1;
} }
@@ -824,9 +824,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet.Initialize (SMSG_AUTH_RESPONSE, 1); packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_UNKNOWN_ACCOUNT); packet << uint8 (AUTH_UNKNOWN_ACCOUNT);
SendPacket (packet); SendPacket(packet);
sLog->outError ("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
return -1; return -1;
} }
@@ -860,7 +860,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{ {
packet.Initialize (SMSG_AUTH_RESPONSE, 1); packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_FAILED); packet << uint8 (AUTH_FAILED);
SendPacket (packet); SendPacket(packet);
sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
return -1; return -1;
@@ -924,9 +924,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{ {
packet.Initialize (SMSG_AUTH_RESPONSE, 1); packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_BANNED); packet << uint8 (AUTH_BANNED);
SendPacket (packet); SendPacket(packet);
sLog->outError ("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
return -1; return -1;
} }
@@ -938,9 +938,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
WorldPacket Packet (SMSG_AUTH_RESPONSE, 1); WorldPacket Packet (SMSG_AUTH_RESPONSE, 1);
Packet << uint8 (AUTH_UNAVAILABLE); Packet << uint8 (AUTH_UNAVAILABLE);
SendPacket (packet); SendPacket(packet);
sLog->outDetail ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); sLog->outDetail("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
return -1; return -1;
} }
@@ -960,9 +960,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet.Initialize (SMSG_AUTH_RESPONSE, 1); packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_FAILED); packet << uint8 (AUTH_FAILED);
SendPacket (packet); SendPacket(packet);
sLog->outError ("WorldSocket::HandleAuthSession: Sent Auth Response (authentification failed)."); sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (authentification failed).");
return -1; return -1;
} }
@@ -1067,7 +1067,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
m_Session->SetLatency (latency); m_Session->SetLatency (latency);
else else
{ {
sLog->outError ("WorldSocket::HandlePing: peer sent CMSG_PING, " sLog->outError("WorldSocket::HandlePing: peer sent CMSG_PING, "
"but is not authenticated or got recently kicked, " "but is not authenticated or got recently kicked, "
" address = %s", " address = %s",
GetRemoteAddress().c_str()); GetRemoteAddress().c_str());
@@ -1077,5 +1077,5 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
WorldPacket packet (SMSG_PONG, 4); WorldPacket packet (SMSG_PONG, 4);
packet << ping; packet << ping;
return SendPacket (packet); return SendPacket(packet);
} }
+1 -1
View File
@@ -108,7 +108,7 @@ class WorldSocket : public WorldHandler
/// Send A packet on the socket, this function is reentrant. /// Send A packet on the socket, this function is reentrant.
/// @param pct packet to send /// @param pct packet to send
/// @return -1 of failure /// @return -1 of failure
int SendPacket (const WorldPacket& pct); int SendPacket(const WorldPacket& pct);
/// Add reference to this object. /// Add reference to this object.
long AddReference (void); long AddReference (void);
+5 -5
View File
@@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (num_threads <= 0) if (num_threads <= 0)
{ {
sLog->outError ("Network.Threads is wrong in your config file"); sLog->outError("Network.Threads is wrong in your config file");
return -1; return -1;
} }
@@ -253,7 +253,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (m_SockOutUBuff <= 0) if (m_SockOutUBuff <= 0)
{ {
sLog->outError ("Network.OutUBuff is wrong in your config file"); sLog->outError("Network.OutUBuff is wrong in your config file");
return -1; return -1;
} }
@@ -263,7 +263,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1) if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1)
{ {
sLog->outError ("Failed to open acceptor, check if the port is free"); sLog->outError("Failed to open acceptor, check if the port is free");
return -1; return -1;
} }
@@ -327,7 +327,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*) & m_SockOutKBuff, (void*) & m_SockOutKBuff,
sizeof (int)) == -1 && errno != ENOTSUP) sizeof (int)) == -1 && errno != ENOTSUP)
{ {
sLog->outError ("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
return -1; return -1;
} }
} }
@@ -342,7 +342,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*)&ndoption, (void*)&ndoption,
sizeof (int)) == -1) sizeof (int)) == -1)
{ {
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;
} }
} }
+3 -3
View File
@@ -267,7 +267,7 @@ void World::AddSession_(WorldSession* s)
{ {
AddQueuedPlayer (s); AddQueuedPlayer (s);
UpdateMaxSessionCounters(); UpdateMaxSessionCounters();
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;
} }
@@ -284,7 +284,7 @@ void World::AddSession_(WorldSession* s)
float popu = (float)GetActiveSessionCount(); // updated number of users on the server float popu = (float)GetActiveSessionCount(); // updated number of users on the server
popu /= pLimit; popu /= pLimit;
popu *= 2; popu *= 2;
sLog->outDetail ("Server Population (%f).", popu); sLog->outDetail("Server Population (%f).", popu);
} }
} }
@@ -1764,7 +1764,7 @@ void World::SetInitialWorldSettings()
uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
sLog->outString(); sLog->outString();
sLog->outString("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000) ); sLog->outString("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
sLog->outString(); sLog->outString();
} }
+11 -11
View File
@@ -38,11 +38,11 @@ Log::Log() :
Log::~Log() Log::~Log()
{ {
if ( logfile != NULL ) if (logfile != NULL)
fclose(logfile); fclose(logfile);
logfile = NULL; logfile = NULL;
if ( gmLogfile != NULL ) if (gmLogfile != NULL)
fclose(gmLogfile); fclose(gmLogfile);
gmLogfile = NULL; gmLogfile = NULL;
@@ -50,7 +50,7 @@ Log::~Log()
fclose(charLogfile); fclose(charLogfile);
charLogfile = NULL; charLogfile = NULL;
if ( dberLogfile != NULL ) if (dberLogfile != NULL)
fclose(dberLogfile); fclose(dberLogfile);
dberLogfile = NULL; dberLogfile = NULL;
@@ -81,32 +81,32 @@ Log::~Log()
void Log::SetLogLevel(char *Level) void Log::SetLogLevel(char *Level)
{ {
int32 NewLevel =atoi((char*)Level); int32 NewLevel = atoi((char*)Level);
if ( NewLevel <0 ) if (NewLevel < 0)
NewLevel = 0; NewLevel = 0;
m_logLevel = NewLevel; m_logLevel = NewLevel;
outString( "LogLevel is %u", m_logLevel ); outString("LogLevel is %u", m_logLevel);
} }
void Log::SetLogFileLevel(char *Level) void Log::SetLogFileLevel(char *Level)
{ {
int32 NewLevel =atoi((char*)Level); int32 NewLevel = atoi((char*)Level);
if ( NewLevel <0 ) if (NewLevel < 0)
NewLevel = 0; NewLevel = 0;
m_logFileLevel = NewLevel; m_logFileLevel = NewLevel;
outString( "LogFileLevel is %u", m_logFileLevel ); outString("LogFileLevel is %u", m_logFileLevel);
} }
void Log::SetDBLogLevel(char *Level) void Log::SetDBLogLevel(char *Level)
{ {
int32 NewLevel = atoi((char*)Level); int32 NewLevel = atoi((char*)Level);
if ( NewLevel < 0 ) if (NewLevel < 0)
NewLevel = 0; NewLevel = 0;
m_dbLogLevel = NewLevel; m_dbLogLevel = NewLevel;
outString( "DBLogLevel is %u", m_dbLogLevel ); outString("DBLogLevel is %u", m_dbLogLevel);
} }
void Log::Initialize() void Log::Initialize()
+21 -21
View File
@@ -117,28 +117,28 @@ class Log
void SetColor(bool stdout_stream, ColorTypes color); void SetColor(bool stdout_stream, ColorTypes color);
void ResetColor(bool stdout_stream); void ResetColor(bool stdout_stream);
void outErrorST( const char * err, ... ) ATTR_PRINTF(2, 3); void outErrorST(const char * err, ...) ATTR_PRINTF(2, 3);
void outDB( LogTypes type, const char * str ); void outDB(LogTypes type, const char * str);
void outString( const char * str, ... ) ATTR_PRINTF(2, 3); void outString(const char * str, ...) ATTR_PRINTF(2, 3);
void outString( ); void outString();
void outStringInLine( const char * str, ... ) ATTR_PRINTF(2, 3); void outStringInLine(const char * str, ...) ATTR_PRINTF(2, 3);
void outError( const char * err, ... ) ATTR_PRINTF(2, 3); void outError(const char * err, ...) ATTR_PRINTF(2, 3);
void outCrash( const char * err, ... ) ATTR_PRINTF(2, 3); void outCrash(const char * err, ...) ATTR_PRINTF(2, 3);
void outBasic( const char * str, ... ) ATTR_PRINTF(2, 3); void outBasic(const char * str, ...) ATTR_PRINTF(2, 3);
void outDetail( const char * str, ... ) ATTR_PRINTF(2, 3); void outDetail(const char * str, ...) ATTR_PRINTF(2, 3);
void outSQLDev( const char * str, ... ) ATTR_PRINTF(2, 3); void outSQLDev(const char * str, ...) ATTR_PRINTF(2, 3);
void outDebug(DebugLogFilters f, const char* str, ...) ATTR_PRINTF(3, 4); void outDebug(DebugLogFilters f, const char* str, ...) ATTR_PRINTF(3, 4);
void outStaticDebug( const char * str, ... ) ATTR_PRINTF(2, 3); void outStaticDebug(const char * str, ...) ATTR_PRINTF(2, 3);
void outDebugInLine( const char * str, ... ) ATTR_PRINTF(2, 3); void outDebugInLine(const char * str, ...) ATTR_PRINTF(2, 3);
void outErrorDb( const char * str, ... ) ATTR_PRINTF(2, 3); void outErrorDb(const char * str, ...) ATTR_PRINTF(2, 3);
void outChar( const char * str, ... ) ATTR_PRINTF(2, 3); void outChar(const char * str, ...) ATTR_PRINTF(2, 3);
void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4);
void outRemote( const char * str, ... ) ATTR_PRINTF(2, 3); void outRemote(const char * str, ...) ATTR_PRINTF(2, 3);
void outChat( const char * str, ... ) ATTR_PRINTF(2, 3); void outChat(const char * str, ...) ATTR_PRINTF(2, 3);
void outArena( const char * str, ... ) ATTR_PRINTF(2, 3); void outArena(const char * str, ...) ATTR_PRINTF(2, 3);
void outSQLDriver( const char* str, ... ) ATTR_PRINTF(2, 3); void outSQLDriver(const char* str, ...) ATTR_PRINTF(2, 3);
void outWarden( const char * str, ... ) ATTR_PRINTF(2, 3); void outWarden(const char * str, ...) ATTR_PRINTF(2, 3);
void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name ); void outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name);
static void outTimestamp(FILE* file); static void outTimestamp(FILE* file);
static std::string GetTimestampStr(); static std::string GetTimestampStr();