Some minor code changes.

With the introduction of user-defined literals in C++11, code that uses
format macro constants with no space after the preceding string literal
is invalid.

Also avoid using code that will be seen by a C++11 compiler as an
invalid use of a variably-modified type (a variable-length array or
type derived from it).
This commit is contained in:
evil-at-wow 2016-03-21 11:49:44 +00:00 committed by Antz
parent baf374d2f9
commit ca40e29e69

View File

@ -7064,7 +7064,8 @@ void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced)
PropagateSpeedChange(); PropagateSpeedChange();
const uint16 SetSpeed2Opc_table[MAX_MOVE_TYPE][2] = typedef const uint16 SpeedOpcodePair[2];
SpeedOpcodePair SetSpeed2Opc_table[MAX_MOVE_TYPE] =
{ {
{SMSG_FORCE_WALK_SPEED_CHANGE, SMSG_SPLINE_SET_WALK_SPEED}, {SMSG_FORCE_WALK_SPEED_CHANGE, SMSG_SPLINE_SET_WALK_SPEED},
{SMSG_FORCE_RUN_SPEED_CHANGE, SMSG_SPLINE_SET_RUN_SPEED}, {SMSG_FORCE_RUN_SPEED_CHANGE, SMSG_SPLINE_SET_RUN_SPEED},
@ -7074,19 +7075,21 @@ void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced)
{SMSG_FORCE_TURN_RATE_CHANGE, SMSG_SPLINE_SET_TURN_RATE}, {SMSG_FORCE_TURN_RATE_CHANGE, SMSG_SPLINE_SET_TURN_RATE},
}; };
const SpeedOpcodePair& speedOpcodes = SetSpeed2Opc_table[mtype];
if (forced && GetTypeId() == TYPEID_PLAYER) if (forced && GetTypeId() == TYPEID_PLAYER)
{ {
// register forced speed changes for WorldSession::HandleForceSpeedChangeAck // register forced speed changes for WorldSession::HandleForceSpeedChangeAck
// and do it only for real sent packets and use run for run/mounted as client expected // and do it only for real sent packets and use run for run/mounted as client expected
++((Player*)this)->m_forced_speed_changes[mtype]; ++((Player*)this)->m_forced_speed_changes[mtype];
WorldPacket data(SetSpeed2Opc_table[mtype][0], 18); WorldPacket data(speedOpcodes[0], 18);
data << GetPackGUID(); data << GetPackGUID();
data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39 data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39
data << float(GetSpeed(mtype)); data << float(GetSpeed(mtype));
((Player*)this)->GetSession()->SendPacket(&data); ((Player*)this)->GetSession()->SendPacket(&data);
} }
WorldPacket data(SetSpeed2Opc_table[mtype][1], 12); WorldPacket data(speedOpcodes[1], 12);
data << GetPackGUID(); data << GetPackGUID();
data << float(GetSpeed(mtype)); data << float(GetSpeed(mtype));
SendMessageToSet(&data, false); SendMessageToSet(&data, false);