aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/VehicleHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/VehicleHandler.cpp')
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp50
1 files changed, 12 insertions, 38 deletions
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index e17b33c345b..4181332fc02 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -28,7 +28,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
- uint64 vehicleGUID = _player->GetCharmGUID();
+ ObjectGuid vehicleGUID = _player->GetCharmGUID();
if (!vehicleGUID) // something wrong here...
{
@@ -100,7 +100,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
GetPlayer()->ReadMovementInfo(recvData, &movementInfo, &extra);
vehicle_base->m_movementInfo = movementInfo;
- uint64 accessory = extra.Data.guid;
+ ObjectGuid accessory = extra.Data.guid;
int8 seatId = extra.Data.byteData;
if (vehicle_base->GetGUID() != movementInfo.guid)
@@ -118,8 +118,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
}
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
{
- uint64 guid; // current vehicle guid
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // current vehicle guid
+ recvData >> guid.ReadAsPacked();
int8 seatId;
recvData >> seatId;
@@ -140,7 +140,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
void WorldSession::HandleEnterPlayerVehicle(WorldPacket& data)
{
// Read guid
- uint64 guid;
+ ObjectGuid guid;
data >> guid;
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -162,63 +162,37 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data)
if (!vehicle)
{
data.rfinish(); // prevent warnings spam
- TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
+ TC_LOG_ERROR("network", "HandleEjectPassenger: %s is not in a vehicle!", GetPlayer()->GetGUID().ToString().c_str());
return;
}
- uint64 guid;
+ ObjectGuid guid;
data >> guid;
- if (IS_PLAYER_GUID(guid))
- {
- Player* player = ObjectAccessor::FindPlayer(guid);
- if (!player)
- {
- TC_LOG_ERROR("network", "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- return;
- }
-
- if (!player->IsOnVehicle(vehicle->GetBase()))
- {
- TC_LOG_ERROR("network", "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- return;
- }
-
- VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(player);
- ASSERT(seat);
- if (seat->IsEjectable())
- player->ExitVehicle();
- else
- TC_LOG_ERROR("network", "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- }
-
- else if (IS_CREATURE_GUID(guid))
+ if (guid.IsUnit())
{
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
if (!unit) // creatures can be ejected too from player mounts
{
- TC_LOG_ERROR("network", "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "%s tried to eject %s from vehicle, but the latter was not found in world!", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
return;
}
if (!unit->IsOnVehicle(vehicle->GetBase()))
{
- TC_LOG_ERROR("network", "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "%s tried to eject %s, but they are not in the same vehicle", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
return;
}
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(unit);
ASSERT(seat);
if (seat->IsEjectable())
- {
- ASSERT(GetPlayer() == vehicle->GetBase());
unit->ExitVehicle();
- }
else
- TC_LOG_ERROR("network", "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "Player %u attempted to eject %s from non-ejectable seat.", GetPlayer()->GetGUIDLow(), guid.ToString().c_str());
}
else
- TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
+ TC_LOG_ERROR("network", "HandleEjectPassenger: %s tried to eject invalid %s ", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
}
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)