Some coding style fixes.

This commit is contained in:
tomrus88 2009-05-26 14:41:57 +04:00
parent 2f15546120
commit ec4928008c
4 changed files with 41 additions and 45 deletions

View file

@ -1002,8 +1002,8 @@ struct ItemLimitCategoryEntry
uint32 ID; // 0 Id uint32 ID; // 0 Id
//char* name[16] // 1-16 m_name_lang //char* name[16] // 1-16 m_name_lang
// 17 name flags // 17 name flags
uint32 maxCount; // max allowed equipped as item or in gem slot uint32 maxCount; // 18, max allowed equipped as item or in gem slot
//uint32 unk; // 1 for prismatic gems only... //uint32 unk; // 19, 1 for gems only...
}; };
struct ItemRandomPropertiesEntry struct ItemRandomPropertiesEntry

View file

@ -1008,7 +1008,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
return; return;
} }
else 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) void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)

View file

@ -115,7 +115,7 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh )
{ {
if(!m_uint32Values) _InitValues(); 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 ); SetUInt64Value( OBJECT_FIELD_GUID, guid );
SetUInt32Value( OBJECT_FIELD_TYPE, m_objectType ); SetUInt32Value( OBJECT_FIELD_TYPE, m_objectType );
m_PackGUID.clear(); m_PackGUID.clear();
@ -137,16 +137,14 @@ void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags ) const
void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
{ {
if(!target) if(!target)
{
return; return;
}
uint8 updatetype = UPDATETYPE_CREATE_OBJECT; uint8 updatetype = UPDATETYPE_CREATE_OBJECT;
uint16 flags = m_updateFlag; uint16 flags = m_updateFlag;
uint32 flags2 = 0; uint32 flags2 = 0;
/** lower flag1 **/ /** lower flag1 **/
if(target == this) // building packet for oneself if(target == this) // building packet for yourself
flags |= UPDATEFLAG_SELF; flags |= UPDATEFLAG_SELF;
if(flags & UPDATEFLAG_HAS_POSITION) if(flags & UPDATEFLAG_HAS_POSITION)
@ -189,7 +187,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
ByteBuffer buf(50); ByteBuffer buf(50);
buf << (uint8)updatetype; buf << (uint8)updatetype;
buf.append(GetPackGUID()); //client crashes when using this buf.append(GetPackGUID());
buf << (uint8)m_objectTypeId; buf << (uint8)m_objectTypeId;
_BuildMovementUpdate(&buf, flags, flags2); _BuildMovementUpdate(&buf, flags, flags2);
@ -197,7 +195,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
UpdateMask updateMask; UpdateMask updateMask;
updateMask.SetCount( m_valuesCount ); updateMask.SetCount( m_valuesCount );
_SetCreateBits( &updateMask, target ); _SetCreateBits( &updateMask, target );
_BuildValuesUpdate(updatetype, &buf, &updateMask, target ); _BuildValuesUpdate(updatetype, &buf, &updateMask, target);
data->AddUpdateBlock(buf); data->AddUpdateBlock(buf);
} }
@ -220,8 +218,6 @@ void Object::SendUpdateToPlayer(Player* player)
BuildCreateUpdateBlockForPlayer(&upd, player); BuildCreateUpdateBlockForPlayer(&upd, player);
upd.BuildPacket(&packet); upd.BuildPacket(&packet);
player->GetSession()->SendPacket(&packet); player->GetSession()->SendPacket(&packet);
// now object updated/(create updated)
} }
void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
@ -229,13 +225,13 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) c
ByteBuffer buf(50); ByteBuffer buf(50);
buf << (uint8) UPDATETYPE_VALUES; 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 updateMask;
updateMask.SetCount( m_valuesCount ); updateMask.SetCount( m_valuesCount );
_SetUpdateBits( &updateMask, target ); _SetUpdateBits( &updateMask, target );
_BuildValuesUpdate(UPDATETYPE_VALUES, &buf, &updateMask, target ); _BuildValuesUpdate(UPDATETYPE_VALUES, &buf, &updateMask, target);
data->AddUpdateBlock(buf); 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()) if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport())
{ {
@ -685,7 +681,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
*data << uint32(1); *data << uint32(1);
break; break;
default: default:
*data << uint32(0); // unknown. not happen. *data << uint32(0); // unknown, not happen.
break; break;
} }
} }
@ -926,21 +922,21 @@ void Object::ApplyModUInt32Value(uint16 index, int32 val, bool apply)
cur += (apply ? val : -val); cur += (apply ? val : -val);
if(cur < 0) if(cur < 0)
cur = 0; cur = 0;
SetUInt32Value(index,cur); SetUInt32Value(index, cur);
} }
void Object::ApplyModInt32Value(uint16 index, int32 val, bool apply) void Object::ApplyModInt32Value(uint16 index, int32 val, bool apply)
{ {
int32 cur = GetInt32Value(index); int32 cur = GetInt32Value(index);
cur += (apply ? val : -val); cur += (apply ? val : -val);
SetInt32Value(index,cur); SetInt32Value(index, cur);
} }
void Object::ApplyModSignedFloatValue(uint16 index, float val, bool apply) void Object::ApplyModSignedFloatValue(uint16 index, float val, bool apply)
{ {
float cur = GetFloatValue(index); float cur = GetFloatValue(index);
cur += (apply ? val : -val); cur += (apply ? val : -val);
SetFloatValue(index,cur); SetFloatValue(index, cur);
} }
void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply) 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); cur += (apply ? val : -val);
if(cur < 0) if(cur < 0)
cur = 0; cur = 0;
SetFloatValue(index,cur); SetFloatValue(index, cur);
} }
void Object::SetFlag( uint16 index, uint32 newFlag ) 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 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 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 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() InstanceData* WorldObject::GetInstanceData()
@ -1500,10 +1496,10 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const*
*data << (uint8)msgtype; *data << (uint8)msgtype;
*data << (uint32)language; *data << (uint32)language;
*data << (uint64)GetGUID(); *data << (uint64)GetGUID();
*data << (uint32)0; //2.1.0 *data << (uint32)0; // 2.1.0
*data << (uint32)(strlen(name)+1); *data << (uint32)(strlen(name)+1);
*data << name; *data << name;
*data << (uint64)targetGuid; //Unit Target *data << (uint64)targetGuid; // Unit Target
if( targetGuid && !IS_PLAYER_GUID(targetGuid) ) if( targetGuid && !IS_PLAYER_GUID(targetGuid) )
{ {
*data << (uint32)1; // target name length *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()) if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI())
((Creature*)this)->AI()->JustSummoned(pCreature); ((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; return pCreature;
} }

View file

@ -181,24 +181,24 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty
data << SubName; data << SubName;
data << ci->IconName; // "Directions" for guard, string for Icons 2.3.0 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_flags); // flags
data << uint32(ci->type); data << uint32(ci->type); // CreatureType.dbc
data << uint32(ci->family); // family wdbFeild9 data << uint32(ci->family); // CreatureFamily.dbc
data << uint32(ci->rank); // rank wdbFeild10 data << uint32(ci->rank); // Creature Rank (elite, boss, etc)
data << uint32(ci->PetSpellDataId); // Id from CreatureSpellData.dbc wdbField12 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_A); // modelid_male1
data << uint32(ci->DisplayID_H); // modelid_female1 ? data << uint32(ci->DisplayID_H); // modelid_female1 ?
data << uint32(ci->DisplayID_A2); // modelid_male2 ? data << uint32(ci->DisplayID_A2); // modelid_male2 ?
data << uint32(ci->DisplayID_H2); // modelid_femmale2 ? data << uint32(ci->DisplayID_H2); // modelid_femmale2 ?
data << uint32(0); // new in 3.1
data << float(ci->unk16); // unk data << float(ci->unk16); // unk
data << float(ci->unk17); // unk data << float(ci->unk17); // unk
data << uint8(ci->RacialLeader); data << uint8(ci->RacialLeader);
for(uint32 i = 0; i < 4; ++i) for(uint32 i = 0; i < 4; ++i)
data << uint32(0); // added in 3.1 data << uint32(0); // itemId[4], quest drop
data << uint32(0); // added in 3.1 data << uint32(0); // CreatureMovementInfo.dbc
SendPacket( &data ); SendPacket( &data );
sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" );
} }
else else
{ {
@ -210,7 +210,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 ); WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 );
data << uint32(entry | 0x80000000); data << uint32(entry | 0x80000000);
SendPacket( &data ); 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.append(info->raw.data, 24);
data << float(info->size); // go size data << float(info->size); // go size
for(uint32 i = 0; i < 4; ++i) for(uint32 i = 0; i < 4; ++i)
data << uint32(0); // added in 3.1 data << uint32(0); // itemId[4], quest drop
SendPacket( &data ); SendPacket( &data );
sLog.outDebug( "WORLD: Sent CMSG_GAMEOBJECT_QUERY " ); sLog.outDebug( "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE" );
} }
else else
{ {
@ -274,7 +274,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data )
WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 4 ); WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 4 );
data << uint32(entryID | 0x80000000); data << uint32(entryID | 0x80000000);
SendPacket( &data ); 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 ) void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,4+8); CHECK_PACKET_SIZE(recv_data, 4 + 8);
uint32 textID; uint32 textID;
uint64 guid; uint64 guid;
@ -361,7 +361,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data )
else else
{ {
std::string Text_0[8], Text_1[8]; 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_0[i]=pGossip->Options[i].Text_0;
Text_1[i]=pGossip->Options[i].Text_1; Text_1[i]=pGossip->Options[i].Text_1;
@ -373,7 +373,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data )
NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID); NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID);
if (nl) 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()) 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]; 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; data << pGossip->Options[i].Probability;
@ -409,12 +409,12 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data )
SendPacket( &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 ) void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,4); CHECK_PACKET_SIZE(recv_data, 4);
uint32 pageID; uint32 pageID;
@ -455,6 +455,6 @@ void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data )
} }
SendPacket( &data ); SendPacket( &data );
sLog.outDebug( "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE " ); sLog.outDebug( "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE" );
} }
} }