From ec4928008cc4ca6b9aef338d3204b6cf92c84543 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Tue, 26 May 2009 14:41:57 +0400 Subject: [PATCH] Some coding style fixes. --- src/game/DBCStructure.h | 4 ++-- src/game/ItemHandler.cpp | 2 +- src/game/Object.cpp | 40 ++++++++++++++++++--------------------- src/game/QueryHandler.cpp | 40 +++++++++++++++++++-------------------- 4 files changed, 41 insertions(+), 45 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index b171f7324..cc2df4b37 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1002,8 +1002,8 @@ struct ItemLimitCategoryEntry uint32 ID; // 0 Id //char* name[16] // 1-16 m_name_lang // 17 name flags - uint32 maxCount; // max allowed equipped as item or in gem slot - //uint32 unk; // 1 for prismatic gems only... + uint32 maxCount; // 18, max allowed equipped as item or in gem slot + //uint32 unk; // 19, 1 for gems only... }; struct ItemRandomPropertiesEntry diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index bbcec610a..f65ff661c 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -1008,7 +1008,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) return; } else - sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item)", itemid); + sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item)", itemid); } void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index dceb72df9..c7a41b52d 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -115,7 +115,7 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh ) { if(!m_uint32Values) _InitValues(); - uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh); // required more changes to make it working + uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh); SetUInt64Value( OBJECT_FIELD_GUID, guid ); SetUInt32Value( OBJECT_FIELD_TYPE, m_objectType ); m_PackGUID.clear(); @@ -137,16 +137,14 @@ void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags ) const void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const { if(!target) - { return; - } uint8 updatetype = UPDATETYPE_CREATE_OBJECT; uint16 flags = m_updateFlag; uint32 flags2 = 0; /** lower flag1 **/ - if(target == this) // building packet for oneself + if(target == this) // building packet for yourself flags |= UPDATEFLAG_SELF; if(flags & UPDATEFLAG_HAS_POSITION) @@ -189,7 +187,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c ByteBuffer buf(50); buf << (uint8)updatetype; - buf.append(GetPackGUID()); //client crashes when using this + buf.append(GetPackGUID()); buf << (uint8)m_objectTypeId; _BuildMovementUpdate(&buf, flags, flags2); @@ -197,7 +195,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); - _BuildValuesUpdate(updatetype, &buf, &updateMask, target ); + _BuildValuesUpdate(updatetype, &buf, &updateMask, target); data->AddUpdateBlock(buf); } @@ -220,8 +218,6 @@ void Object::SendUpdateToPlayer(Player* player) BuildCreateUpdateBlockForPlayer(&upd, player); upd.BuildPacket(&packet); player->GetSession()->SendPacket(&packet); - - // now object updated/(create updated) } void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const @@ -229,13 +225,13 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) c ByteBuffer buf(50); buf << (uint8) UPDATETYPE_VALUES; - buf.append(GetPackGUID()); //client crashes when using this. but not have crash in debug mode + buf.append(GetPackGUID()); UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetUpdateBits( &updateMask, target ); - _BuildValuesUpdate(UPDATETYPE_VALUES, &buf, &updateMask, target ); + _BuildValuesUpdate(UPDATETYPE_VALUES, &buf, &updateMask, target); data->AddUpdateBlock(buf); } @@ -595,7 +591,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask } } } - else //case UPDATETYPE_VALUES + else // case UPDATETYPE_VALUES { if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport()) { @@ -685,7 +681,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *data << uint32(1); break; default: - *data << uint32(0); // unknown. not happen. + *data << uint32(0); // unknown, not happen. break; } } @@ -926,21 +922,21 @@ void Object::ApplyModUInt32Value(uint16 index, int32 val, bool apply) cur += (apply ? val : -val); if(cur < 0) cur = 0; - SetUInt32Value(index,cur); + SetUInt32Value(index, cur); } void Object::ApplyModInt32Value(uint16 index, int32 val, bool apply) { int32 cur = GetInt32Value(index); cur += (apply ? val : -val); - SetInt32Value(index,cur); + SetInt32Value(index, cur); } void Object::ApplyModSignedFloatValue(uint16 index, float val, bool apply) { float cur = GetFloatValue(index); cur += (apply ? val : -val); - SetFloatValue(index,cur); + SetFloatValue(index, cur); } void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply) @@ -949,7 +945,7 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply) cur += (apply ? val : -val); if(cur < 0) cur = 0; - SetFloatValue(index,cur); + SetFloatValue(index, cur); } void Object::SetFlag( uint16 index, uint32 newFlag ) @@ -1068,17 +1064,17 @@ void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid, uint uint32 WorldObject::GetZoneId() const { - return MapManager::Instance().GetBaseMap(m_mapId)->GetZoneId(m_positionX,m_positionY,m_positionZ); + return MapManager::Instance().GetBaseMap(m_mapId)->GetZoneId(m_positionX, m_positionY, m_positionZ); } uint32 WorldObject::GetAreaId() const { - return MapManager::Instance().GetBaseMap(m_mapId)->GetAreaId(m_positionX,m_positionY,m_positionZ); + return MapManager::Instance().GetBaseMap(m_mapId)->GetAreaId(m_positionX, m_positionY, m_positionZ); } void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const { - MapManager::Instance().GetBaseMap(m_mapId)->GetZoneAndAreaId(zoneid,areaid,m_positionX,m_positionY,m_positionZ); + MapManager::Instance().GetBaseMap(m_mapId)->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ); } InstanceData* WorldObject::GetInstanceData() @@ -1500,10 +1496,10 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* *data << (uint8)msgtype; *data << (uint32)language; *data << (uint64)GetGUID(); - *data << (uint32)0; //2.1.0 + *data << (uint32)0; // 2.1.0 *data << (uint32)(strlen(name)+1); *data << name; - *data << (uint64)targetGuid; //Unit Target + *data << (uint64)targetGuid; // Unit Target if( targetGuid && !IS_PLAYER_GUID(targetGuid) ) { *data << (uint32)1; // target name length @@ -1624,7 +1620,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI()) ((Creature*)this)->AI()->JustSummoned(pCreature); - //return the creature therewith the summoner has access to it + // return the creature therewith the summoner has access to it return pCreature; } diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 86b165236..b1506f8a2 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -181,24 +181,24 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty data << SubName; data << ci->IconName; // "Directions" for guard, string for Icons 2.3.0 - data << uint32(ci->type_flags); // flags wdbFeild7=wad flags1 - data << uint32(ci->type); - data << uint32(ci->family); // family wdbFeild9 - data << uint32(ci->rank); // rank wdbFeild10 - data << uint32(ci->PetSpellDataId); // Id from CreatureSpellData.dbc wdbField12 + data << uint32(ci->type_flags); // flags + data << uint32(ci->type); // CreatureType.dbc + data << uint32(ci->family); // CreatureFamily.dbc + data << uint32(ci->rank); // Creature Rank (elite, boss, etc) + data << uint32(0); // new in 3.1, creature entry? + data << uint32(0); // new in 3.1, creature entry? data << uint32(ci->DisplayID_A); // modelid_male1 data << uint32(ci->DisplayID_H); // modelid_female1 ? data << uint32(ci->DisplayID_A2); // modelid_male2 ? data << uint32(ci->DisplayID_H2); // modelid_femmale2 ? - data << uint32(0); // new in 3.1 data << float(ci->unk16); // unk data << float(ci->unk17); // unk data << uint8(ci->RacialLeader); for(uint32 i = 0; i < 4; ++i) - data << uint32(0); // added in 3.1 - data << uint32(0); // added in 3.1 + data << uint32(0); // itemId[4], quest drop + data << uint32(0); // CreatureMovementInfo.dbc SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); + sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" ); } else { @@ -210,7 +210,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 ); data << uint32(entry | 0x80000000); SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); + sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" ); } } @@ -259,9 +259,9 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) data.append(info->raw.data, 24); data << float(info->size); // go size for(uint32 i = 0; i < 4; ++i) - data << uint32(0); // added in 3.1 + data << uint32(0); // itemId[4], quest drop SendPacket( &data ); - sLog.outDebug( "WORLD: Sent CMSG_GAMEOBJECT_QUERY " ); + sLog.outDebug( "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE" ); } else { @@ -274,7 +274,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 4 ); data << uint32(entryID | 0x80000000); SendPacket( &data ); - sLog.outDebug( "WORLD: Sent CMSG_GAMEOBJECT_QUERY " ); + sLog.outDebug( "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE" ); } } @@ -326,7 +326,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4+8); + CHECK_PACKET_SIZE(recv_data, 4 + 8); uint32 textID; uint64 guid; @@ -361,7 +361,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) else { std::string Text_0[8], Text_1[8]; - for (int i=0;i<8;++i) + for (int i = 0; i < 8; ++i) { Text_0[i]=pGossip->Options[i].Text_0; Text_1[i]=pGossip->Options[i].Text_1; @@ -373,7 +373,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID); if (nl) { - for (int i=0;i<8;++i) + for (int i = 0; i < 8; ++i) { if (nl->Text_0[i].size() > size_t(loc_idx) && !nl->Text_0[i][loc_idx].empty()) Text_0[i]=nl->Text_0[i][loc_idx]; @@ -383,7 +383,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) } } - for (int i=0; i<8; ++i) + for (int i = 0; i < 8; ++i) { data << pGossip->Options[i].Probability; @@ -409,12 +409,12 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE " ); + sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE " ); } void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); uint32 pageID; @@ -455,6 +455,6 @@ void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) } SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE " ); + sLog.outDebug( "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE" ); } }