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

@@ -19,9 +19,8 @@ PlayerContainer::~PlayerContainer() {
}
void PlayerContainer::InsertPlayer(Packet* packet) {
CINSTREAM;
CINSTREAM_SKIP_HEADER;
PlayerData* data = new PlayerData();
inStream.SetReadOffset(inStream.GetReadOffset() + 64);
inStream.Read(data->playerID);
uint32_t len;
@@ -52,9 +51,8 @@ void PlayerContainer::InsertPlayer(Packet* packet) {
}
void PlayerContainer::RemovePlayer(Packet* packet) {
CINSTREAM;
CINSTREAM_SKIP_HEADER;
LWOOBJID playerID;
inStream.Read(playerID); //skip header
inStream.Read(playerID);
//Before they get kicked, we need to also send a message to their friends saying that they disconnected.
@@ -97,9 +95,8 @@ void PlayerContainer::RemovePlayer(Packet* packet) {
}
void PlayerContainer::MuteUpdate(Packet* packet) {
CINSTREAM;
CINSTREAM_SKIP_HEADER;
LWOOBJID playerID;
inStream.Read(playerID); //skip header
inStream.Read(playerID);
time_t expire = 0;
inStream.Read(expire);
@@ -118,9 +115,8 @@ void PlayerContainer::MuteUpdate(Packet* packet) {
}
void PlayerContainer::CreateTeamServer(Packet* packet) {
CINSTREAM;
CINSTREAM_SKIP_HEADER;
LWOOBJID playerID;
inStream.Read(playerID); //skip header
inStream.Read(playerID);
size_t membersSize = 0;
inStream.Read(membersSize);