[11156] Update speed for controlled units in any case, does not matter if owner's speed was really changed or not

Also remove static attribute from my prev. commit, thanks to vladimir
This commit is contained in:
SilverIce 2011-02-12 22:40:46 +02:00
parent f31a2d3d84
commit 76ea11489d
2 changed files with 41 additions and 42 deletions

View file

@ -8337,14 +8337,12 @@ void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced)
rate = 0.0f; rate = 0.0f;
// Update speed only on change // Update speed only on change
if (m_speed_rate[mtype] == rate) if (m_speed_rate[mtype] != rate)
return; {
m_speed_rate[mtype] = rate; m_speed_rate[mtype] = rate;
propagateSpeedChange(); propagateSpeedChange();
static const uint16 SetSpeed2Opc_table[MAX_MOVE_TYPE][2]= const uint16 SetSpeed2Opc_table[MAX_MOVE_TYPE][2]=
{ {
{MSG_MOVE_SET_WALK_SPEED, SMSG_FORCE_WALK_SPEED_CHANGE}, {MSG_MOVE_SET_WALK_SPEED, SMSG_FORCE_WALK_SPEED_CHANGE},
{MSG_MOVE_SET_RUN_SPEED, SMSG_FORCE_RUN_SPEED_CHANGE}, {MSG_MOVE_SET_RUN_SPEED, SMSG_FORCE_RUN_SPEED_CHANGE},
@ -8384,6 +8382,7 @@ void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced)
data << float(GetSpeed(mtype)); data << float(GetSpeed(mtype));
SendMessageToSet(&data, true); SendMessageToSet(&data, true);
} }
}
CallForAllControlledUnits(SetSpeedRateHelper(mtype,forced), CONTROLLED_PET|CONTROLLED_GUARDIANS|CONTROLLED_CHARM|CONTROLLED_MINIPET); CallForAllControlledUnits(SetSpeedRateHelper(mtype,forced), CONTROLLED_PET|CONTROLLED_GUARDIANS|CONTROLLED_CHARM|CONTROLLED_MINIPET);
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11155" #define REVISION_NR "11156"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__