mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 06:57:28 +00:00
Windows fixes
- "Fixed" segfault - Fixed logger not actually logging time
This commit is contained in:
parent
b580f19825
commit
393cce885b
@ -92,8 +92,8 @@ void dLogger::Log(const char * className, const char * format, ...) {
|
|||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (m_logToConsole) std::cout << "[" << "timeStr" << "] [" << className << "]: " << message;
|
if (m_logToConsole) std::cout << "[" << timeStr << "] [" << className << "]: " << message;
|
||||||
mFile << "[" << "timeStr" << "] [" << className << "]: " << message;
|
mFile << "[" << timeStr << "] [" << className << "]: " << message;
|
||||||
#else
|
#else
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
struct tm * time = localtime(&t);
|
struct tm * time = localtime(&t);
|
||||||
|
@ -153,27 +153,26 @@ void WorldPackets::SendCreateCharacter(const SystemAddress& sysAddr, const LWOOB
|
|||||||
delete gmlevel;
|
delete gmlevel;
|
||||||
delete chatmode;
|
delete chatmode;
|
||||||
delete name;
|
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:
|
//Compress the data before sending:
|
||||||
const int reservedSize = 5 * 1024 * 1024;
|
const int reservedSize = 5 * 1024 * 1024;
|
||||||
uint8_t compressedData[reservedSize];
|
uint8_t compressedData[reservedSize];
|
||||||
size_t size = ZCompression::Compress(data.GetData(), data.GetNumberOfBytesUsed(), compressedData, reservedSize);
|
size_t size = ZCompression::Compress(data.GetData(), data.GetNumberOfBytesUsed(), compressedData, reservedSize);
|
||||||
|
|
||||||
bitStream.Write<uint32_t>(size + 9); //size of data + header bytes (8)
|
bitStream.Write<uint32_t>(size + 9); //size of data + header bytes (8)
|
||||||
bitStream.Write<uint8_t>(1); //compressed boolean, true
|
bitStream.Write<uint8_t>(1); //compressed boolean, true
|
||||||
bitStream.Write<uint32_t>(data.GetNumberOfBytesUsed());
|
bitStream.Write<uint32_t>(data.GetNumberOfBytesUsed());
|
||||||
bitStream.Write<uint32_t>(size);
|
bitStream.Write<uint32_t>(size);
|
||||||
|
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
bitStream.Write(compressedData[i]);
|
bitStream.Write(compressedData[i]);
|
||||||
|
#endif
|
||||||
/*
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
|
|
||||||
PacketUtils::SavePacket("chardata.bin", (const char *)bitStream.GetData(), static_cast<uint32_t>(bitStream.GetNumberOfBytesUsed()));
|
PacketUtils::SavePacket("chardata.bin", (const char *)bitStream.GetData(), static_cast<uint32_t>(bitStream.GetNumberOfBytesUsed()));
|
||||||
SEND_PACKET
|
SEND_PACKET
|
||||||
Game::logger->Log("WorldPackets", "Sent CreateCharacter for ID: %llu\n", objectID);
|
Game::logger->Log("WorldPackets", "Sent CreateCharacter for ID: %llu\n", objectID);
|
||||||
|
Loading…
Reference in New Issue
Block a user