Skip to content

Commit bb56667

Browse files
authored
Increase vehicle model id range in packet (PR #4324)
1 parent 7856d8b commit bb56667

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

Client/mods/deathmatch/logic/CPacketHandler.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,18 +3219,10 @@ void CPacketHandler::Packet_EntityAdd(NetBitStreamInterface& bitStream)
32193219
SRotationDegreesSync rotationDegrees(false);
32203220
bitStream.Read(&rotationDegrees);
32213221

3222-
// Read out the vehicle value as a char, then convert
3223-
unsigned char ucModel = 0xFF;
3224-
bitStream.Read(ucModel);
3225-
3226-
// The server appears to subtract 400 from the vehicle id before
3227-
// sending it to us, as to allow the value to fit into an unsigned
3228-
// char.
3229-
//
3230-
// Too bad this was never documented.
3231-
//
3232-
// --slush
3233-
unsigned short usModel = ucModel + 400;
3222+
// Read out the vehicle model
3223+
std::uint16_t usModel = 0xFFFF;
3224+
bitStream.Read(usModel);
3225+
32343226
if (!CClientVehicleManager::IsValidModel(usModel))
32353227
{
32363228
RaiseEntityAddError(39);

Server/mods/deathmatch/logic/packets/CEntityAddPacket.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,7 @@ bool CEntityAddPacket::Write(NetBitStreamInterface& BitStream) const
447447
BitStream.Write(&position);
448448
BitStream.Write(&rotationDegrees);
449449

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

457452
// Health
458453
SVehicleHealthSync health;

0 commit comments

Comments
 (0)