mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-16 01:03:51 +00:00
cleanup: migrate 20 remaining setReadPos(getSize()) to skipAll()
The Packet::skipAll() method was introduced to replace the verbose setReadPos(getSize()) pattern. 186 instances were migrated earlier, but 20 survived in domain handler files created after the migration. Also removes a redundant single-element for-loop wrapper around SMSG_LOOT_CLEAR_MONEY registration.
This commit is contained in:
parent
ae32b27d6c
commit
8376757f7e
2 changed files with 11 additions and 13 deletions
|
|
@ -108,7 +108,7 @@ void CombatHandler::registerOpcodes(DispatchTable& table) {
|
|||
table[Opcode::SMSG_ENVIRONMENTAL_DAMAGE_LOG] = [this](network::Packet& packet) {
|
||||
// uint64 victimGuid + uint8 envDmgType + uint32 damage + uint32 absorbed + uint32 resisted
|
||||
// envDmgType: 0=Exhausted(fatigue), 1=Drowning, 2=Fall, 3=Lava, 4=Slime, 5=Fire
|
||||
if (!packet.hasRemaining(21)) { packet.setReadPos(packet.getSize()); return; }
|
||||
if (!packet.hasRemaining(21)) { packet.skipAll(); return; }
|
||||
uint64_t victimGuid = packet.readUInt64();
|
||||
uint8_t envType = packet.readUInt8();
|
||||
uint32_t dmg = packet.readUInt32();
|
||||
|
|
@ -123,7 +123,7 @@ void CombatHandler::registerOpcodes(DispatchTable& table) {
|
|||
if (envRes > 0)
|
||||
addCombatText(CombatTextEntry::RESIST, static_cast<int32_t>(envRes), 0, false, 0, 0, victimGuid);
|
||||
}
|
||||
packet.setReadPos(packet.getSize());
|
||||
packet.skipAll();
|
||||
};
|
||||
|
||||
// ---- Threat updates ----
|
||||
|
|
@ -139,7 +139,7 @@ void CombatHandler::registerOpcodes(DispatchTable& table) {
|
|||
(void)packet.readPackedGuid(); // highest-threat / current target
|
||||
if (!packet.hasRemaining(4)) return;
|
||||
uint32_t cnt = packet.readUInt32();
|
||||
if (cnt > 100) { packet.setReadPos(packet.getSize()); return; } // sanity
|
||||
if (cnt > 100) { packet.skipAll(); return; } // sanity
|
||||
std::vector<ThreatEntry> list;
|
||||
list.reserve(cnt);
|
||||
for (uint32_t i = 0; i < cnt; ++i) {
|
||||
|
|
@ -562,7 +562,7 @@ void CombatHandler::handleSetForcedReactions(network::Packet& packet) {
|
|||
uint32_t count = packet.readUInt32();
|
||||
if (count > 64) {
|
||||
LOG_WARNING("SMSG_SET_FORCED_REACTIONS: suspicious count ", count, ", ignoring");
|
||||
packet.setReadPos(packet.getSize());
|
||||
packet.skipAll();
|
||||
return;
|
||||
}
|
||||
forcedReactions_.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue