mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-29 18:36:35 +00:00
Address review feedback on protocol types
This commit is contained in:
parent
bcc765f3e7
commit
883e98bde0
|
|
@ -10,6 +10,7 @@
|
|||
#include "../../Minecraft.World/Headers/net.minecraft.world.item.h"
|
||||
|
||||
#include "../Platform/Common/Leaderboards/LeaderboardManager.h"
|
||||
#include <cstring>
|
||||
|
||||
Stat** StatsCounter::LARGE_STATS[] = {
|
||||
&Stats::walkOneM,
|
||||
|
|
@ -144,7 +145,7 @@ void StatsCounter::parse(void* data)
|
|||
//Pointer to current position in stat array
|
||||
std::uint8_t* pbData = reinterpret_cast<std::uint8_t*>(data);
|
||||
pbData += sizeof(GAME_SETTINGS);
|
||||
unsigned short* statData = reinterpret_cast<unsigned short*>(pbData);//data + (STAT_DATA_OFFSET/sizeof(unsigned short));
|
||||
std::uint8_t* statData = pbData;
|
||||
|
||||
//Value being read
|
||||
StatContainer newVal;
|
||||
|
|
@ -157,19 +158,22 @@ void StatsCounter::parse(void* data)
|
|||
{
|
||||
if( !isLargeStat(*iter) )
|
||||
{
|
||||
if( statData[0] != 0 || statData[1] != 0 || statData[2] != 0 || statData[3] != 0 )
|
||||
std::uint16_t difficultyStats[eDifficulty_Max] = {};
|
||||
std::memcpy(difficultyStats, statData, sizeof(difficultyStats));
|
||||
if( difficultyStats[0] != 0 || difficultyStats[1] != 0 || difficultyStats[2] != 0 || difficultyStats[3] != 0 )
|
||||
{
|
||||
newVal.stats[0] = statData[0];
|
||||
newVal.stats[1] = statData[1];
|
||||
newVal.stats[2] = statData[2];
|
||||
newVal.stats[3] = statData[3];
|
||||
newVal.stats[0] = difficultyStats[0];
|
||||
newVal.stats[1] = difficultyStats[1];
|
||||
newVal.stats[2] = difficultyStats[2];
|
||||
newVal.stats[3] = difficultyStats[3];
|
||||
stats.insert( std::make_pair(*iter, newVal) );
|
||||
}
|
||||
statData += 4;
|
||||
statData += sizeof(difficultyStats);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int* largeStatData = (unsigned int*)statData;
|
||||
std::uint32_t largeStatData[eDifficulty_Max] = {};
|
||||
std::memcpy(largeStatData, statData, sizeof(largeStatData));
|
||||
if( largeStatData[0] != 0 || largeStatData[1] != 0 || largeStatData[2] != 0 || largeStatData[3] != 0 )
|
||||
{
|
||||
newVal.stats[0] = largeStatData[0];
|
||||
|
|
@ -178,21 +182,22 @@ void StatsCounter::parse(void* data)
|
|||
newVal.stats[3] = largeStatData[3];
|
||||
stats.insert( std::make_pair(*iter, newVal) );
|
||||
}
|
||||
largeStatData += 4;
|
||||
statData = (unsigned short*)largeStatData;
|
||||
statData += sizeof(largeStatData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( statData[0] != 0 )
|
||||
std::uint16_t achievementValue = 0;
|
||||
std::memcpy(&achievementValue, statData, sizeof(achievementValue));
|
||||
if( achievementValue != 0 )
|
||||
{
|
||||
newVal.stats[0] = statData[0];
|
||||
newVal.stats[0] = achievementValue;
|
||||
newVal.stats[1] = 0;
|
||||
newVal.stats[2] = 0;
|
||||
newVal.stats[3] = 0;
|
||||
stats.insert( std::make_pair(*iter, newVal) );
|
||||
}
|
||||
++statData;
|
||||
statData += sizeof(achievementValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -222,8 +227,7 @@ void StatsCounter::save(int player, bool force)
|
|||
pbData += sizeof(GAME_SETTINGS);
|
||||
|
||||
//Pointer to current position in stat array
|
||||
//unsigned short* statData = (unsigned short*)data + (STAT_DATA_OFFSET/sizeof(unsigned short));
|
||||
unsigned short* statData = reinterpret_cast<unsigned short*>(pbData);
|
||||
std::uint8_t* statData = pbData;
|
||||
|
||||
//Reset all the data to 0 (we're going to replace it with the map data)
|
||||
memset(statData, 0, CConsoleMinecraftApp::GAME_DEFINED_PROFILE_DATA_BYTES-sizeof(GAME_SETTINGS));
|
||||
|
|
@ -239,18 +243,20 @@ void StatsCounter::save(int player, bool force)
|
|||
{
|
||||
if( !isLargeStat(*iter) )
|
||||
{
|
||||
std::uint16_t difficultyStats[eDifficulty_Max] = {};
|
||||
if( val != stats.end() )
|
||||
{
|
||||
statData[0] = val->second.stats[0];
|
||||
statData[1] = val->second.stats[1];
|
||||
statData[2] = val->second.stats[2];
|
||||
statData[3] = val->second.stats[3];
|
||||
difficultyStats[0] = static_cast<std::uint16_t>(val->second.stats[0]);
|
||||
difficultyStats[1] = static_cast<std::uint16_t>(val->second.stats[1]);
|
||||
difficultyStats[2] = static_cast<std::uint16_t>(val->second.stats[2]);
|
||||
difficultyStats[3] = static_cast<std::uint16_t>(val->second.stats[3]);
|
||||
}
|
||||
statData += 4;
|
||||
std::memcpy(statData, difficultyStats, sizeof(difficultyStats));
|
||||
statData += sizeof(difficultyStats);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int* largeStatData = (unsigned int*)statData;
|
||||
std::uint32_t largeStatData[eDifficulty_Max] = {};
|
||||
if( val != stats.end() )
|
||||
{
|
||||
largeStatData[0] = val->second.stats[0];
|
||||
|
|
@ -258,17 +264,19 @@ void StatsCounter::save(int player, bool force)
|
|||
largeStatData[2] = val->second.stats[2];
|
||||
largeStatData[3] = val->second.stats[3];
|
||||
}
|
||||
largeStatData += 4;
|
||||
statData = (unsigned short*)largeStatData;
|
||||
std::memcpy(statData, largeStatData, sizeof(largeStatData));
|
||||
statData += sizeof(largeStatData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::uint16_t achievementValue = 0;
|
||||
if( val != stats.end() )
|
||||
{
|
||||
statData[0] = val->second.stats[0];
|
||||
achievementValue = static_cast<std::uint16_t>(val->second.stats[0]);
|
||||
}
|
||||
++statData;
|
||||
std::memcpy(statData, &achievementValue, sizeof(achievementValue));
|
||||
statData += sizeof(achievementValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void AbstractTexturePack::loadIcon()
|
|||
{
|
||||
#ifdef _XBOX
|
||||
// 4J Stu - Temporary only
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
|
@ -56,7 +56,7 @@ void AbstractTexturePack::loadComparison()
|
|||
{
|
||||
#ifdef _XBOX
|
||||
// 4J Stu - Temporary only
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
|
@ -232,7 +232,7 @@ void AbstractTexturePack::loadDefaultUI()
|
|||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
// Load new skin
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur");
|
||||
|
|
@ -291,7 +291,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
|
|||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
// Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable
|
||||
|
|
@ -376,7 +376,7 @@ std::wstring AbstractTexturePack::getXuiRootPath()
|
|||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
// Load new skin
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ void DLCTexturePack::loadColourTable()
|
|||
std::uint32_t dwSize = 0;
|
||||
std::uint8_t *pbData = dataFile->getData(dwSize);
|
||||
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
// Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable
|
||||
|
|
@ -483,7 +483,7 @@ void DLCTexturePack::loadUI()
|
|||
std::uint32_t dwSize = 0;
|
||||
std::uint8_t *pbData = dataFile->getData(dwSize);
|
||||
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#skin_Minecraft.xur",pbData, dwSize);
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ std::wstring DLCTexturePack::getXuiRootPath()
|
|||
std::uint32_t dwSize = 0;
|
||||
std::uint8_t *pbData = dataFile->getData(dwSize);
|
||||
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#",pbData, dwSize);
|
||||
path = szResourceLocator;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ void DefaultTexturePack::loadIcon()
|
|||
{
|
||||
#ifdef _XBOX
|
||||
// 4J Stu - Temporary only
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void FolderTexturePack::loadUI()
|
|||
// Load new skin
|
||||
if(hasFile(L"TexturePack.xzp"))
|
||||
{
|
||||
static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"file://%lsTexturePack.xzp#skin_Minecraft.xur",getPath().c_str());
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "../../UI/SimpleIcon.h"
|
||||
#include "../CompassTexture.h"
|
||||
#include "../ClockTexture.h"
|
||||
#include <cstring>
|
||||
|
||||
const std::wstring PreStitchedTextureMap::NAME_MISSING_TEXTURE = L"missingno";
|
||||
|
||||
|
|
@ -178,7 +179,7 @@ void PreStitchedTextureMap::stitch()
|
|||
|
||||
#ifdef __PSVITA__
|
||||
// AP - alpha cut out is expensive on vita so we mark which icons actually require it
|
||||
std::uint32_t *data = reinterpret_cast<std::uint32_t*>(this->getStitchedTexture()->getData()->getBuffer());
|
||||
const std::uint8_t *data = this->getStitchedTexture()->getData()->getBuffer();
|
||||
int Width = this->getStitchedTexture()->getWidth();
|
||||
int Height = this->getStitchedTexture()->getHeight();
|
||||
for(AUTO_VAR(it, texturesByName.begin()); it != texturesByName.end(); ++it)
|
||||
|
|
@ -196,8 +197,10 @@ void PreStitchedTextureMap::stitch()
|
|||
{
|
||||
for( int u = u0;u < u1; u+= 1 )
|
||||
{
|
||||
std::uint32_t pixel = 0;
|
||||
std::memcpy(&pixel, data + ((v * Width + u) * sizeof(pixel)), sizeof(pixel));
|
||||
// is this texel alpha value < 0.1
|
||||
if( (data[v * Width + u] & 0xff000000) < 0x20000000 )
|
||||
if( (pixel & 0xff000000) < 0x20000000 )
|
||||
{
|
||||
// this texel is transparent. Mark the icon as such and bail
|
||||
preStitched->setFlags(Icon::IS_ALPHA_CUT_OUT);
|
||||
|
|
|
|||
|
|
@ -78,11 +78,9 @@ void AddPlayerPacket::read(DataInputStream *dis) //throws IOException
|
|||
carriedItem = dis->readShort();
|
||||
xuid = dis->readPlayerUID();
|
||||
OnlineXuid = dis->readPlayerUID();
|
||||
m_playerIndex = static_cast<std::uint8_t>(dis->readByte());
|
||||
int skinId = dis->readInt();
|
||||
std::memcpy(&m_skinId, &skinId, sizeof(m_skinId));
|
||||
int capeId = dis->readInt();
|
||||
std::memcpy(&m_capeId, &capeId, sizeof(m_capeId));
|
||||
m_playerIndex = dis->readByte();
|
||||
m_skinId = static_cast<std::uint32_t>(dis->readInt());
|
||||
m_capeId = static_cast<std::uint32_t>(dis->readInt());
|
||||
INT privileges = dis->readInt();
|
||||
m_uiGamePrivileges = *(unsigned int *)&privileges;
|
||||
MemSect(1);
|
||||
|
|
@ -104,12 +102,8 @@ void AddPlayerPacket::write(DataOutputStream *dos) //throws IOException
|
|||
dos->writePlayerUID(xuid);
|
||||
dos->writePlayerUID(OnlineXuid);
|
||||
dos->writeByte(static_cast<std::uint8_t>(m_playerIndex)); // 4J Added
|
||||
int skinId = 0;
|
||||
std::memcpy(&skinId, &m_skinId, sizeof(m_skinId));
|
||||
dos->writeInt(skinId);
|
||||
int capeId = 0;
|
||||
std::memcpy(&capeId, &m_capeId, sizeof(m_capeId));
|
||||
dos->writeInt(capeId);
|
||||
dos->writeInt(static_cast<int>(m_skinId));
|
||||
dos->writeInt(static_cast<int>(m_capeId));
|
||||
dos->writeInt(m_uiGamePrivileges);
|
||||
entityData->packAll(dos);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ void KickPlayerPacket::handle(PacketListener *listener)
|
|||
|
||||
void KickPlayerPacket::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
m_networkSmallId = static_cast<std::uint8_t>(dis->readByte());
|
||||
m_networkSmallId = dis->readByte();
|
||||
}
|
||||
|
||||
void KickPlayerPacket::write(DataOutputStream *dos) //throws IOException
|
||||
|
|
|
|||
|
|
@ -107,20 +107,17 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException
|
|||
seed = dis->readLong();
|
||||
gameType = dis->readInt();
|
||||
dimension = (int)dis->readByte();
|
||||
mapHeight = static_cast<std::uint8_t>(dis->readByte());
|
||||
maxPlayers = static_cast<std::uint8_t>(dis->readByte());
|
||||
mapHeight = dis->readByte();
|
||||
maxPlayers = dis->readByte();
|
||||
m_offlineXuid = dis->readPlayerUID();
|
||||
m_onlineXuid = dis->readPlayerUID();
|
||||
m_friendsOnlyUGC = dis->readBoolean();
|
||||
int ugcPlayersVersion = dis->readInt();
|
||||
std::memcpy(&m_ugcPlayersVersion, &ugcPlayersVersion, sizeof(m_ugcPlayersVersion));
|
||||
m_ugcPlayersVersion = static_cast<std::uint32_t>(dis->readInt());
|
||||
difficulty = (int)dis->readByte();
|
||||
m_multiplayerInstanceId = dis->readInt();
|
||||
m_playerIndex = static_cast<std::uint8_t>(dis->readByte());
|
||||
int skinId = dis->readInt();
|
||||
std::memcpy(&m_playerSkinId, &skinId, sizeof(m_playerSkinId));
|
||||
int capeId = dis->readInt();
|
||||
std::memcpy(&m_playerCapeId, &capeId, sizeof(m_playerCapeId));
|
||||
m_playerIndex = dis->readByte();
|
||||
m_playerSkinId = static_cast<std::uint32_t>(dis->readInt());
|
||||
m_playerCapeId = static_cast<std::uint32_t>(dis->readInt());
|
||||
m_isGuest = dis->readBoolean();
|
||||
m_newSeaLevel = dis->readBoolean();
|
||||
m_uiGamePrivileges = dis->readInt();
|
||||
|
|
@ -152,18 +149,12 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException
|
|||
dos->writePlayerUID(m_offlineXuid);
|
||||
dos->writePlayerUID(m_onlineXuid);
|
||||
dos->writeBoolean(m_friendsOnlyUGC);
|
||||
int ugcPlayersVersion = 0;
|
||||
std::memcpy(&ugcPlayersVersion, &m_ugcPlayersVersion, sizeof(m_ugcPlayersVersion));
|
||||
dos->writeInt(ugcPlayersVersion);
|
||||
dos->writeInt(static_cast<int>(m_ugcPlayersVersion));
|
||||
dos->writeByte((std::uint8_t)difficulty);
|
||||
dos->writeInt(m_multiplayerInstanceId);
|
||||
dos->writeByte((std::uint8_t)m_playerIndex);
|
||||
int skinId = 0;
|
||||
std::memcpy(&skinId, &m_playerSkinId, sizeof(m_playerSkinId));
|
||||
dos->writeInt(skinId);
|
||||
int capeId = 0;
|
||||
std::memcpy(&capeId, &m_playerCapeId, sizeof(m_playerCapeId));
|
||||
dos->writeInt(capeId);
|
||||
dos->writeInt(static_cast<int>(m_playerSkinId));
|
||||
dos->writeInt(static_cast<int>(m_playerCapeId));
|
||||
dos->writeBoolean(m_isGuest);
|
||||
dos->writeBoolean(m_newSeaLevel);
|
||||
dos->writeInt(m_uiGamePrivileges);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ PlayerInfoPacket::PlayerInfoPacket(std::shared_ptr<ServerPlayer> player)
|
|||
|
||||
void PlayerInfoPacket::read(DataInputStream *dis)
|
||||
{
|
||||
m_networkSmallId = static_cast<std::uint8_t>(dis->readByte());
|
||||
m_networkSmallId = dis->readByte();
|
||||
m_playerColourIndex = dis->readShort();
|
||||
m_playerPrivileges = dis->readInt();
|
||||
m_entityId = dis->readInt();
|
||||
|
|
|
|||
|
|
@ -59,10 +59,9 @@ void PreLoginPacket::read(DataInputStream *dis) //throws IOException
|
|||
|
||||
loginKey = readUtf(dis, 32);
|
||||
|
||||
m_friendsOnlyBits = static_cast<std::uint8_t>(dis->readByte());
|
||||
std::int32_t ugcPlayersVersion = dis->readInt();
|
||||
std::memcpy(&m_ugcPlayersVersion, &ugcPlayersVersion, sizeof(m_ugcPlayersVersion));
|
||||
m_dwPlayerCount = static_cast<std::uint8_t>(dis->readByte());
|
||||
m_friendsOnlyBits = dis->readByte();
|
||||
m_ugcPlayersVersion = static_cast<std::uint32_t>(dis->readInt());
|
||||
m_dwPlayerCount = dis->readByte();
|
||||
if( m_dwPlayerCount > 0 )
|
||||
{
|
||||
m_playerXuids = new PlayerUID[m_dwPlayerCount];
|
||||
|
|
@ -75,12 +74,10 @@ void PreLoginPacket::read(DataInputStream *dis) //throws IOException
|
|||
{
|
||||
m_szUniqueSaveName[i] = static_cast<char>(dis->readByte());
|
||||
}
|
||||
std::int32_t serverSettings = dis->readInt();
|
||||
std::memcpy(&m_serverSettings, &serverSettings, sizeof(m_serverSettings));
|
||||
m_hostIndex = static_cast<std::uint8_t>(dis->readByte());
|
||||
m_serverSettings = static_cast<std::uint32_t>(dis->readInt());
|
||||
m_hostIndex = dis->readByte();
|
||||
|
||||
std::int32_t texturePackId = dis->readInt();
|
||||
std::memcpy(&m_texturePackId, &texturePackId, sizeof(m_texturePackId));
|
||||
m_texturePackId = static_cast<std::uint32_t>(dis->readInt());
|
||||
|
||||
// Set the name of the map so we can check it for players banned lists
|
||||
app.SetUniqueMapName((char *)m_szUniqueSaveName);
|
||||
|
|
@ -93,9 +90,7 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException
|
|||
writeUtf(loginKey, dos);
|
||||
|
||||
dos->writeByte(m_friendsOnlyBits);
|
||||
std::int32_t ugcPlayersVersion = 0;
|
||||
std::memcpy(&ugcPlayersVersion, &m_ugcPlayersVersion, sizeof(m_ugcPlayersVersion));
|
||||
dos->writeInt(ugcPlayersVersion);
|
||||
dos->writeInt(static_cast<int>(m_ugcPlayersVersion));
|
||||
dos->writeByte((std::uint8_t)m_dwPlayerCount);
|
||||
for(std::uint32_t i = 0; i < m_dwPlayerCount; ++i)
|
||||
{
|
||||
|
|
@ -107,13 +102,9 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException
|
|||
{
|
||||
dos->writeByte(static_cast<std::uint8_t>(m_szUniqueSaveName[i]));
|
||||
}
|
||||
std::int32_t serverSettings = 0;
|
||||
std::memcpy(&serverSettings, &m_serverSettings, sizeof(m_serverSettings));
|
||||
dos->writeInt(serverSettings);
|
||||
dos->writeInt(static_cast<int>(m_serverSettings));
|
||||
dos->writeByte(m_hostIndex);
|
||||
std::int32_t texturePackId = 0;
|
||||
std::memcpy(&texturePackId, &m_texturePackId, sizeof(texturePackId));
|
||||
dos->writeInt(texturePackId);
|
||||
dos->writeInt(static_cast<int>(m_texturePackId));
|
||||
}
|
||||
|
||||
void PreLoginPacket::handle(PacketListener *listener)
|
||||
|
|
|
|||
Loading…
Reference in a new issue