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();
// 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))
{
// 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
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
if (itr->Guid == guid)
{
Members.erase(itr);
break;
}
}
// Inform player and remove arena team info from player data
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -75,9 +75,9 @@ void ObjectPosSelector::InitializeAngle()
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);
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 false;
@@ -100,7 +100,7 @@ bool ObjectPosSelector::NextAngle(float& angle)
bool ObjectPosSelector::NextUsedAngle(float& angle)
{
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
if (!NextPosibleAngle(angle))
@@ -114,7 +114,7 @@ bool ObjectPosSelector::NextPosibleAngle(float& angle)
{
// ++ direction less updated
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;
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);
data << uint8(itemClass) << uint32(itemSubclassMask);
GetSession()->SendPacket (&data);
GetSession()->SendPacket(&data);
}
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:
{
// 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;
// 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;
break;
}
+1 -1
View File
@@ -756,7 +756,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p,
if (!p || !p->GetSession())
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 << uint32(mapId); // 3.3.3 mapid
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);
data << uint8(CHAR_NAME_RESERVED);
SendPacket (&data);
SendPacket(&data);
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)
{
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;
}
// 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);
return false;
+2 -2
View File
@@ -202,11 +202,11 @@ void MotionMaster::MoveTargetedHome()
}
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();
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);
}
}
@@ -118,7 +118,7 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
// waiting for next move
i_nextMoveTime.Update(diff);
if(i_nextMoveTime.Passed() )
if (i_nextMoveTime.Passed())
{
// start moving
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_nextCheckTime.Reset( urand(500,1000) );
i_nextCheckTime.Reset(urand(500,1000));
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) ||
// if we reach bigger distance
(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'
{
// we are very far or too close, stopping
i_to_distance_from_caster = 0.0f;
i_nextCheckTime.Reset( urand(500,1000) );
i_nextCheckTime.Reset(urand(500,1000));
return false;
}
else
@@ -231,7 +231,7 @@ void FlightPathMovementGenerator::Reset(Player & player)
uint32 end = GetPathAtMapEnd();
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.SetFirstPointId(GetCurrentNode());
@@ -34,6 +34,7 @@ WorldLog::~WorldLog()
{
if (i_file != NULL)
fclose(i_file);
i_file = NULL;
}
+2 -1
View File
@@ -195,7 +195,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
}
#endif // !TRINITY_DEBUG
if (m_Socket->SendPacket (*packet) == -1)
if (m_Socket->SendPacket(*packet) == -1)
m_Socket->CloseSocket();
}
@@ -922,6 +922,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
{
if (data.rpos() + 4 > data.size())
return;
uint32 size;
data >> size;
+22 -22
View File
@@ -152,7 +152,7 @@ const std::string& WorldSocket::GetRemoteAddress (void) const
return m_Address;
}
int WorldSocket::SendPacket (const WorldPacket& pct)
int WorldSocket::SendPacket(const WorldPacket& pct)
{
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)
{
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;
}
@@ -277,7 +277,7 @@ int WorldSocket::open (void *a)
// Register with ACE Reactor
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;
}
@@ -496,7 +496,7 @@ int WorldSocket::handle_input_header (void)
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
{
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,
_player ? _player->GetGUIDLow() : 0,
_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
if (!m_RecvWPct)
{
sLog->outError ("Forcing close on input m_RecvWPct = NULL");
sLog->outError("Forcing close on input m_RecvWPct = NULL");
errno = EINVAL;
return -1;
}
@@ -648,7 +648,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g)
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
// 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;
}
@@ -667,7 +667,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g)
if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
sLog->outError ("WorldSocket::schedule_wakeup_output");
sLog->outError("WorldSocket::schedule_wakeup_output");
return -1;
}
@@ -715,7 +715,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
case CMSG_AUTH_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;
}
@@ -744,7 +744,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
}
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;
}
}
@@ -788,9 +788,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{
packet.Initialize(SMSG_AUTH_RESPONSE, 1);
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;
}
@@ -824,9 +824,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
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;
}
@@ -860,7 +860,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_FAILED);
SendPacket (packet);
SendPacket(packet);
sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
return -1;
@@ -924,9 +924,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
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;
}
@@ -938,9 +938,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
WorldPacket Packet (SMSG_AUTH_RESPONSE, 1);
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;
}
@@ -960,9 +960,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
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;
}
@@ -1067,7 +1067,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
m_Session->SetLatency (latency);
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, "
" address = %s",
GetRemoteAddress().c_str());
@@ -1077,5 +1077,5 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
WorldPacket packet (SMSG_PONG, 4);
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.
/// @param pct packet to send
/// @return -1 of failure
int SendPacket (const WorldPacket& pct);
int SendPacket(const WorldPacket& pct);
/// Add reference to this object.
long AddReference (void);
+5 -5
View File
@@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
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;
}
@@ -253,7 +253,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
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;
}
@@ -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)
{
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;
}
@@ -327,7 +327,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*) & m_SockOutKBuff,
sizeof (int)) == -1 && errno != ENOTSUP)
{
sLog->outError ("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
return -1;
}
}
@@ -342,7 +342,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*)&ndoption,
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;
}
}
+3 -3
View File
@@ -267,7 +267,7 @@ void World::AddSession_(WorldSession* s)
{
AddQueuedPlayer (s);
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;
}
@@ -284,7 +284,7 @@ void World::AddSession_(WorldSession* s)
float popu = (float)GetActiveSessionCount(); // updated number of users on the server
popu /= pLimit;
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);
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();
}