mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-27 09:03:51 +00:00
refactor: move hasFullPackedGuid into Packet class, deduplicate 2 definitions
Add Packet::hasFullPackedGuid() method and remove identical standalone definitions from game_handler.cpp and packet_parsers_classic.cpp. Replace 53 free-function calls with method calls.
This commit is contained in:
parent
376d0a0f77
commit
40dd39feed
4 changed files with 61 additions and 85 deletions
|
|
@ -34,6 +34,14 @@ public:
|
|||
size_t getReadPos() const { return readPos; }
|
||||
size_t getSize() const { return data.size(); }
|
||||
size_t getRemainingSize() const { return data.size() - readPos; }
|
||||
bool hasFullPackedGuid() const {
|
||||
if (readPos >= data.size()) return false;
|
||||
uint8_t mask = data[readPos];
|
||||
size_t guidBytes = 1;
|
||||
for (int bit = 0; bit < 8; ++bit)
|
||||
if (mask & (1u << bit)) ++guidBytes;
|
||||
return getRemainingSize() >= guidBytes;
|
||||
}
|
||||
void setReadPos(size_t pos) { readPos = pos; }
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue