mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Some coding style fixes.
This commit is contained in:
parent
2f15546120
commit
ec4928008c
4 changed files with 41 additions and 45 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue