mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
chore: Eradicate C-style casts and further clean up some code (#1361)
* cast and code cleanup * cast cleanup * bug fixes and improvements * no getBoolField method exists * fixes * unbroke sg cannon scoring * removing comments * Remove the c-style cast warning I added from CMakeLists now that they're gone (it triggers on 3rd party dependencies and slows down compilation) * (Hopefully) fix MacOS compilation error * partially-implemented feedback * more updates to account for feedback * change bool default --------- Co-authored-by: jadebenn <jonahebenn@yahoo.com>
This commit is contained in:
@@ -64,12 +64,12 @@ void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, c
|
||||
return;
|
||||
}
|
||||
bitStream.Write<uint32_t>(netVersion);
|
||||
bitStream.Write(uint32_t(0x93));
|
||||
bitStream.Write<uint32_t>(0x93);
|
||||
|
||||
if (serverType == ServerType::Auth) bitStream.Write(uint32_t(1)); //Conn: auth
|
||||
else bitStream.Write(uint32_t(4)); //Conn: world
|
||||
else bitStream.Write<uint32_t>(4); //Conn: world
|
||||
|
||||
bitStream.Write(uint32_t(0)); //Server process ID
|
||||
bitStream.Write<uint32_t>(0); //Server process ID
|
||||
bitStream.Write(nextServerPort);
|
||||
|
||||
server->Send(&bitStream, sysAddr, false);
|
||||
@@ -155,7 +155,7 @@ void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAdd
|
||||
RakNet::BitStream packet;
|
||||
BitStreamUtils::WriteHeader(packet, eConnectionType::CLIENT, eClientMessageType::LOGIN_RESPONSE);
|
||||
|
||||
packet.Write(static_cast<uint8_t>(responseCode));
|
||||
packet.Write<uint8_t>(GeneralUtils::CastUnderlyingType(responseCode));
|
||||
|
||||
// Event Gating
|
||||
packet.Write(LUString(Game::config->GetValue("event_1")));
|
||||
@@ -189,8 +189,8 @@ void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAdd
|
||||
packet.Write(LUString(""));
|
||||
|
||||
// Write the Character and Chat Ports
|
||||
packet.Write(static_cast<uint16_t>(wServerPort));
|
||||
packet.Write(static_cast<uint16_t>(0));
|
||||
packet.Write<uint16_t>(wServerPort);
|
||||
packet.Write<uint16_t>(0);
|
||||
|
||||
// CDN Key
|
||||
packet.Write(LUString(""));
|
||||
@@ -198,26 +198,26 @@ void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAdd
|
||||
// CDN Ticket
|
||||
packet.Write(LUString("00000000-0000-0000-0000-000000000000", 37));
|
||||
|
||||
packet.Write(static_cast<uint32_t>(0)); // Language
|
||||
packet.Write<uint32_t>(0); // Language
|
||||
|
||||
// Write the localization
|
||||
packet.Write(LUString("US", 3));
|
||||
|
||||
packet.Write(static_cast<uint8_t>(false)); // Just upgraded from F2P
|
||||
packet.Write(static_cast<uint8_t>(false)); // User is F2P
|
||||
packet.Write(static_cast<uint64_t>(0)); // Time Remaining in F2P
|
||||
packet.Write<uint8_t>(false); // Just upgraded from F2P
|
||||
packet.Write<uint8_t>(false); // User is F2P
|
||||
packet.Write<uint64_t>(0); // Time Remaining in F2P
|
||||
|
||||
// Write custom error message
|
||||
packet.Write(static_cast<uint16_t>(errorMsg.length()));
|
||||
packet.Write<uint16_t>(errorMsg.length());
|
||||
packet.Write(LUWString(errorMsg, static_cast<uint32_t>(errorMsg.length())));
|
||||
|
||||
// Here write auth logs
|
||||
packet.Write(static_cast<uint32_t>(20));
|
||||
packet.Write<uint32_t>(20);
|
||||
for (uint32_t i = 0; i < 20; ++i) {
|
||||
packet.Write(static_cast<uint32_t>(8));
|
||||
packet.Write(static_cast<uint32_t>(44));
|
||||
packet.Write(static_cast<uint32_t>(14000));
|
||||
packet.Write(static_cast<uint32_t>(0));
|
||||
packet.Write<uint32_t>(8);
|
||||
packet.Write<uint32_t>(44);
|
||||
packet.Write<uint32_t>(14000);
|
||||
packet.Write<uint32_t>(0);
|
||||
}
|
||||
|
||||
server->Send(&packet, sysAddr, false);
|
||||
|
Reference in New Issue
Block a user