mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
refactor: extract updateNetworking() from GameHandler::update()
Move socket update, packet processing, Warden async drain, RX silence detection, disconnect handling, and Warden gate logging into a separate updateNetworking() method. Reduces update() from ~704 to ~591 lines.
This commit is contained in:
parent
b2e2ad12c6
commit
7066062136
2 changed files with 19 additions and 13 deletions
|
|
@ -2314,6 +2314,7 @@ public:
|
||||||
* @param deltaTime Time since last update in seconds
|
* @param deltaTime Time since last update in seconds
|
||||||
*/
|
*/
|
||||||
void update(float deltaTime);
|
void update(float deltaTime);
|
||||||
|
void updateNetworking(float deltaTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset DBC-backed caches so they reload from new expansion data.
|
* Reset DBC-backed caches so they reload from new expansion data.
|
||||||
|
|
|
||||||
|
|
@ -844,19 +844,7 @@ bool GameHandler::isConnected() const {
|
||||||
return socket && socket->isConnected();
|
return socket && socket->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameHandler::update(float deltaTime) {
|
void GameHandler::updateNetworking(float deltaTime) {
|
||||||
// Fire deferred char-create callback (outside ImGui render)
|
|
||||||
if (pendingCharCreateResult_) {
|
|
||||||
pendingCharCreateResult_ = false;
|
|
||||||
if (charCreateCallback_) {
|
|
||||||
charCreateCallback_(pendingCharCreateSuccess_, pendingCharCreateMsg_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!socket) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset per-tick monster-move budget tracking (Classic/Turtle flood protection).
|
// Reset per-tick monster-move budget tracking (Classic/Turtle flood protection).
|
||||||
monsterMovePacketsThisTick_ = 0;
|
monsterMovePacketsThisTick_ = 0;
|
||||||
monsterMovePacketsDroppedThisTick_ = 0;
|
monsterMovePacketsDroppedThisTick_ = 0;
|
||||||
|
|
@ -938,6 +926,23 @@ void GameHandler::update(float deltaTime) {
|
||||||
wardenGateNextStatusLog_ += 30.0f;
|
wardenGateNextStatusLog_ += 30.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameHandler::update(float deltaTime) {
|
||||||
|
// Fire deferred char-create callback (outside ImGui render)
|
||||||
|
if (pendingCharCreateResult_) {
|
||||||
|
pendingCharCreateResult_ = false;
|
||||||
|
if (charCreateCallback_) {
|
||||||
|
charCreateCallback_(pendingCharCreateSuccess_, pendingCharCreateMsg_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!socket) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateNetworking(deltaTime);
|
||||||
|
if (!socket) return; // disconnect() may have been called
|
||||||
|
|
||||||
// Validate target still exists
|
// Validate target still exists
|
||||||
if (targetGuid != 0 && !entityManager.hasEntity(targetGuid)) {
|
if (targetGuid != 0 && !entityManager.hasEntity(targetGuid)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue