Make header skips more obvious (#1074)

* Make header skips more obvious

seeing inStream.Read(LWOOBJID) is much less clear than a macro which very clearly skips the header.

* Formatting pass
This commit is contained in:
David Markowitz
2023-05-08 04:31:10 -07:00
committed by GitHub
parent 64a947e338
commit 7aad6e4bc2
7 changed files with 63 additions and 51 deletions

View File

@@ -554,10 +554,9 @@ void HandlePacketChat(Packet* packet) {
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::CHAT_INTERNAL) {
switch (static_cast<eChatInternalMessageType>(packet->data[3])) {
case eChatInternalMessageType::ROUTE_TO_PLAYER: {
CINSTREAM;
CINSTREAM_SKIP_HEADER;
LWOOBJID playerID;
inStream.Read(playerID);
inStream.Read(playerID);
auto player = EntityManager::Instance()->GetEntity(playerID);
if (!player) return;
@@ -576,9 +575,7 @@ void HandlePacketChat(Packet* packet) {
}
case eChatInternalMessageType::ANNOUNCEMENT: {
CINSTREAM;
LWOOBJID header;
inStream.Read(header);
CINSTREAM_SKIP_HEADER;
std::string title;
std::string msg;
@@ -615,11 +612,10 @@ void HandlePacketChat(Packet* packet) {
}
case eChatInternalMessageType::MUTE_UPDATE: {
CINSTREAM;
CINSTREAM_SKIP_HEADER;
LWOOBJID playerId;
time_t expire = 0;
inStream.Read(playerId);
inStream.Read(playerId);
inStream.Read(expire);
auto* entity = EntityManager::Instance()->GetEntity(playerId);
@@ -634,9 +630,7 @@ void HandlePacketChat(Packet* packet) {
}
case eChatInternalMessageType::TEAM_UPDATE: {
CINSTREAM;
LWOOBJID header;
inStream.Read(header);
CINSTREAM_SKIP_HEADER;
LWOOBJID teamID = 0;
char lootOption = 0;
@@ -1213,10 +1207,8 @@ void HandlePacket(Packet* packet) {
case eWorldMessageType::ROUTE_PACKET: {
//Yeet to chat
CINSTREAM;
uint64_t header = 0;
CINSTREAM_SKIP_HEADER;
uint32_t size = 0;
inStream.Read(header);
inStream.Read(size);
if (size > 20000) {