[11543] Fixed change form to same (powershifting)

Inspired by patch provided by darkstalker.

Client expected receive form field change at form switing including case with switch to same form.
In fact problem too good mangos optimization in part avoid send unchanged values in update fields.

* Added function Object::SendForcedObjectUpdate()
* It used in form apply code for make sure received by client non-form applied state in middle form shifting state.
* It also used for fishing code when client also expected received some update fields chnages before
  animation update. New function send update to all all client instead before used code that send it to fishing player
  and resend later one more time to other players and player itself as normal update.
This commit is contained in:
VladimirMangos 2011-05-26 17:09:09 +04:00
parent 81984732a3
commit c5b6cc0b37
5 changed files with 50 additions and 31 deletions

View file

@ -108,6 +108,25 @@ void Object::SetObjectScale(float newScale)
SetFloatValue(OBJECT_FIELD_SCALE_X, newScale);
}
void Object::SendForcedObjectUpdate()
{
if (!m_inWorld || !m_objectUpdated)
return;
UpdateDataMapType update_players;
BuildUpdateData(update_players);
RemoveFromClientUpdateList();
WorldPacket packet; // here we allocate a std::vector with a size of 0x10000
for(UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
{
iter->second.BuildPacket(&packet);
iter->first->GetSession()->SendPacket(&packet);
packet.clear(); // clean the string
}
}
void Object::BuildMovementUpdateBlock(UpdateData * data, uint16 flags ) const
{
ByteBuffer buf(500);