mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-31 08:15:43 +00:00
applied changes requested by tropicaaal
"i would prefer that these be cast to sized integer types int8_t for portability reasons." "The light layer changes are ultimately a hack over the broken renderer implementation and probably out of scope for this PR. There's an in-progress fix for the root cause of this, so this should be removed." "std::numeric_limits<int16_t>::max()"
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "../../Platform/stdafx.h"
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include "../../IO/Streams/InputOutputStream.h"
|
||||
#include "PacketListener.h"
|
||||
#include "MoveEntityPacketSmall.h"
|
||||
@@ -31,7 +32,7 @@ void MoveEntityPacketSmall::read(DataInputStream *dis) //throws IOException
|
||||
|
||||
void MoveEntityPacketSmall::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
if(id < 0 || id > 32767 )
|
||||
if(id < 0 || id > std::numeric_limits<int16_t>::max() )
|
||||
{
|
||||
// We shouln't be tracking an entity that doesn't have a short type of id
|
||||
__debugbreak();
|
||||
@@ -65,7 +66,7 @@ MoveEntityPacketSmall::PosRot::PosRot()
|
||||
hasRot = true;
|
||||
}
|
||||
|
||||
MoveEntityPacketSmall::PosRot::PosRot(int id, char xa, char ya, char za, char yRot, char xRot) : MoveEntityPacketSmall( id )
|
||||
MoveEntityPacketSmall::PosRot::PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot) : MoveEntityPacketSmall( id )
|
||||
{
|
||||
this->xa = xa;
|
||||
this->ya = ya;
|
||||
@@ -77,22 +78,22 @@ MoveEntityPacketSmall::PosRot::PosRot(int id, char xa, char ya, char za, char yR
|
||||
|
||||
void MoveEntityPacketSmall::PosRot::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
MoveEntityPacketSmall::read(dis);
|
||||
xa = (signed char)dis->readByte();
|
||||
ya = (signed char)dis->readByte();
|
||||
za = (signed char)dis->readByte();
|
||||
yRot = (signed char)dis->readByte();
|
||||
xRot = (signed char)dis->readByte();
|
||||
MoveEntityPacketSmall::read(dis);
|
||||
xa = (int8_t)dis->readByte();
|
||||
ya = (int8_t)dis->readByte();
|
||||
za = (int8_t)dis->readByte();
|
||||
yRot = (int8_t)dis->readByte();
|
||||
xRot = (int8_t)dis->readByte();
|
||||
}
|
||||
|
||||
void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
MoveEntityPacketSmall::write(dos);
|
||||
dos->writeByte((uint8_t)(xa & 0xFF));
|
||||
dos->writeByte((uint8_t)(ya & 0xFF));
|
||||
dos->writeByte((uint8_t)(za & 0xFF));
|
||||
dos->writeByte((uint8_t)(yRot & 0xFF));
|
||||
dos->writeByte((uint8_t)(xRot & 0xFF));
|
||||
MoveEntityPacketSmall::write(dos);
|
||||
dos->writeByte((uint8_t)(xa & 0xFF));
|
||||
dos->writeByte((uint8_t)(ya & 0xFF));
|
||||
dos->writeByte((uint8_t)(za & 0xFF));
|
||||
dos->writeByte((uint8_t)(yRot & 0xFF));
|
||||
dos->writeByte((uint8_t)(xRot & 0xFF));
|
||||
}
|
||||
|
||||
int MoveEntityPacketSmall::PosRot::getEstimatedSize()
|
||||
@@ -104,7 +105,7 @@ MoveEntityPacketSmall::Pos::Pos()
|
||||
{
|
||||
}
|
||||
|
||||
MoveEntityPacketSmall::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityPacketSmall(id)
|
||||
MoveEntityPacketSmall::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveEntityPacketSmall(id)
|
||||
{
|
||||
this->xa = xa;
|
||||
this->ya = ya;
|
||||
@@ -113,10 +114,10 @@ MoveEntityPacketSmall::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityP
|
||||
|
||||
void MoveEntityPacketSmall::Pos::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
MoveEntityPacketSmall::read(dis);
|
||||
xa = (signed char)dis->readByte();
|
||||
ya = (signed char)dis->readByte();
|
||||
za = (signed char)dis->readByte();
|
||||
MoveEntityPacketSmall::read(dis);
|
||||
xa = (int8_t)dis->readByte();
|
||||
ya = (int8_t)dis->readByte();
|
||||
za = (int8_t)dis->readByte();
|
||||
}
|
||||
|
||||
void MoveEntityPacketSmall::Pos::write(DataOutputStream *dos) //throws IOException
|
||||
@@ -137,7 +138,7 @@ MoveEntityPacketSmall::Rot::Rot()
|
||||
hasRot = true;
|
||||
}
|
||||
|
||||
MoveEntityPacketSmall::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacketSmall(id)
|
||||
MoveEntityPacketSmall::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPacketSmall(id)
|
||||
{
|
||||
|
||||
this->yRot = yRot;
|
||||
@@ -147,8 +148,8 @@ MoveEntityPacketSmall::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacket
|
||||
|
||||
void MoveEntityPacketSmall::Rot::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
MoveEntityPacketSmall::read(dis);
|
||||
yRot = (signed char)dis->readByte();
|
||||
MoveEntityPacketSmall::read(dis);
|
||||
yRot = (int8_t)dis->readByte();
|
||||
}
|
||||
|
||||
void MoveEntityPacketSmall::Rot::write(DataOutputStream *dos) //throws IOException
|
||||
|
||||
Reference in New Issue
Block a user