Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions Client/mods/deathmatch/logic/CPacketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3219,18 +3219,10 @@ void CPacketHandler::Packet_EntityAdd(NetBitStreamInterface& bitStream)
SRotationDegreesSync rotationDegrees(false);
bitStream.Read(&rotationDegrees);

// Read out the vehicle value as a char, then convert
unsigned char ucModel = 0xFF;
bitStream.Read(ucModel);

// The server appears to subtract 400 from the vehicle id before
// sending it to us, as to allow the value to fit into an unsigned
// char.
//
// Too bad this was never documented.
//
// --slush
unsigned short usModel = ucModel + 400;
// Read out the vehicle model
std::uint16_t usModel = 0xFFFF;
bitStream.Read(usModel);

if (!CClientVehicleManager::IsValidModel(usModel))
{
RaiseEntityAddError(39);
Expand Down
7 changes: 1 addition & 6 deletions Server/mods/deathmatch/logic/packets/CEntityAddPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,7 @@ bool CEntityAddPacket::Write(NetBitStreamInterface& BitStream) const
BitStream.Write(&position);
BitStream.Write(&rotationDegrees);

// Vehicle id as a char
// I'm assuming the "-400" is for adjustment so that all car values can
// fit into a char? Why doesn't someone document this?
//
// --slush
BitStream.Write(static_cast<unsigned char>(pVehicle->GetModel() - 400));
BitStream.Write(static_cast<std::uint16_t>(pVehicle->GetModel()));

// Health
SVehicleHealthSync health;
Expand Down
Loading