Merge pull request #88 from OogwayUniverse/windows

Windows fixes (needs proper ZCompresion fix in the future)
This commit is contained in:
Gie "Max" Vanommeslaeghe 2021-12-07 17:30:37 +01:00 committed by GitHub
commit 6e33f5e545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 13 deletions

View File

@ -92,8 +92,8 @@ void dLogger::Log(const char * className, const char * format, ...) {
va_end(args);
if (m_logToConsole) std::cout << "[" << "timeStr" << "] [" << className << "]: " << message;
mFile << "[" << "timeStr" << "] [" << className << "]: " << message;
if (m_logToConsole) std::cout << "[" << timeStr << "] [" << className << "]: " << message;
mFile << "[" << timeStr << "] [" << className << "]: " << message;
#else
time_t t = time(NULL);
struct tm * time = localtime(&t);

View File

@ -154,6 +154,11 @@ void WorldPackets::SendCreateCharacter(const SystemAddress& sysAddr, const LWOOB
delete chatmode;
delete name;
#ifdef _WIN32
bitStream.Write<uint32_t>(data.GetNumberOfBytesUsed() + 1);
bitStream.Write<uint8_t>(0);
bitStream.Write((char*)data.GetData(), data.GetNumberOfBytesUsed());
#else
//Compress the data before sending:
const int reservedSize = 5 * 1024 * 1024;
uint8_t compressedData[reservedSize];
@ -166,13 +171,7 @@ void WorldPackets::SendCreateCharacter(const SystemAddress& sysAddr, const LWOOB
for (size_t i = 0; i < size; i++)
bitStream.Write(compressedData[i]);
/*
uint32_t dataSize = data.GetNumberOfBytesUsed();
bitStream.Write(dataSize + 8); // The data size
bitStream.Write(static_cast<uint8_t>(0)); // Data is not compressed
bitStream.Write(data); // Write the data
*/
#endif
PacketUtils::SavePacket("chardata.bin", (const char *)bitStream.GetData(), static_cast<uint32_t>(bitStream.GetNumberOfBytesUsed()));
SEND_PACKET