[10732] Not send session fields as args into HandleMoverRelocation/VerifyMovementInfo.

Also mark args as constant where expected in this functions.
This commit is contained in:
VladimirMangos 2010-11-18 06:03:17 +03:00
parent bd48d3cdc9
commit 10273fa38a
3 changed files with 13 additions and 11 deletions

View file

@ -241,7 +241,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
recv_data >> movementInfo;
/*----------------*/
if (!VerifyMovementInfo(movementInfo,guid,mover))
if (!VerifyMovementInfo(movementInfo, guid))
return;
// fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
@ -249,7 +249,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
plMover->HandleFall(movementInfo);
/* process position-change */
HandleMoverRelocation(movementInfo,mover,plMover);
HandleMoverRelocation(movementInfo);
if (plMover)
plMover->UpdateFallInformationIfNeed(movementInfo, opcode);
@ -432,10 +432,10 @@ void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
recv_data >> Unused<uint32>(); // knockback packets counter
recv_data >> movementInfo;
if (!VerifyMovementInfo(movementInfo,guid,mover))
if (!VerifyMovementInfo(movementInfo, guid))
return;
HandleMoverRelocation(movementInfo, mover, plMover);
HandleMoverRelocation(movementInfo);
WorldPacket data(MSG_MOVE_KNOCK_BACK, recv_data.size() + 15);
data << mover->GetPackGUID();
@ -486,10 +486,10 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
_player->SummonIfPossible(agree);
}
bool WorldSession::VerifyMovementInfo(MovementInfo& movementInfo, ObjectGuid& guid, Unit* mover) const
bool WorldSession::VerifyMovementInfo(MovementInfo const& movementInfo, ObjectGuid const& guid) const
{
// ignore wrong guid (player attempt cheating own session for not own guid possible...)
if (guid != mover->GetObjectGuid())
if (guid != _player->GetMover()->GetObjectGuid())
return false;
if (!MaNGOS::IsValidMapCoord(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o))
@ -512,11 +512,13 @@ bool WorldSession::VerifyMovementInfo(MovementInfo& movementInfo, ObjectGuid& gu
return true;
}
void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo, Unit* mover, Player* plMover)
void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
{
movementInfo.UpdateTime(getMSTime());
if (plMover)
Unit *mover = _player->GetMover();
if (Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL)
{
if (movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT))
{

View file

@ -778,8 +778,8 @@ class MANGOS_DLL_SPEC WorldSession
private:
// private trade methods
void moveItems(Item* myItems[], Item* hisItems[]);
bool VerifyMovementInfo(MovementInfo&,ObjectGuid&, Unit*) const;
void HandleMoverRelocation(MovementInfo&, Unit*, Player*);
bool VerifyMovementInfo(MovementInfo const& movementInfo, ObjectGuid const& guid) const;
void HandleMoverRelocation(MovementInfo& movementInfo);
void ExecuteOpcode( OpcodeHandler const& opHandle, WorldPacket* packet );

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10731"
#define REVISION_NR "10732"
#endif // __REVISION_NR_H__