mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-15 08:53:51 +00:00
feat(game): introduce GameHandler domain interfaces and eliminate friend declarations
Add game_interfaces.hpp with five narrow domain contracts that GameHandler now publishes to its domain handlers, replacing the previous friend-class anti-pattern. Changes: - include/game/game_interfaces.hpp (new): IConnectionState, ITargetingState, IEntityAccess, ISocialState, IPvpState — each interface exposes only the state its consumer legitimately needs - include/game/game_handler.hpp: GameHandler inherits all five interfaces; include of game_interfaces.hpp added - include/game/movement_handler.hpp: remove `friend class GameHandler`; add public named accessors for previously-private fields (monsterMovePacketsThisTickRef, timeSinceLastMoveHeartbeatRef, resetMovementClock, setFalling, setFallStartMs) - include/game/spell_handler.hpp: remove `friend class GameHandler/InventoryHandler/ CombatHandler/EntityController`; promote private packet handlers (handlePetSpells, handleListStabledPets, pet stable commands, DBC loaders) to public; add accessor methods for aura cache, known spells, and player aura slot mutation - src/game/game_handler.cpp, game_handler_callbacks.cpp, game_handler_packets.cpp: replace direct private field access with the new accessor API (e.g. casting_ → isCasting(), monsterMovePacketsThisTick_ → ...ThisTickRef()) - src/game/inventory_handler.cpp, combat_handler.cpp, entity_controller.cpp: replace friend-class private access with public accessor calls No behaviour change. All 13 test suites pass. Zero build warnings.
This commit is contained in:
parent
34c0e3ca28
commit
65839287b4
10 changed files with 196 additions and 47 deletions
|
|
@ -573,13 +573,12 @@ void GameHandler::handleLoginVerifyWorld(network::Packet& packet) {
|
|||
movementInfo.flags = 0;
|
||||
movementInfo.flags2 = 0;
|
||||
if (movementHandler_) {
|
||||
movementHandler_->movementClockStart_ = std::chrono::steady_clock::now();
|
||||
movementHandler_->lastMovementTimestampMs_ = 0;
|
||||
movementHandler_->resetMovementClock();
|
||||
}
|
||||
movementInfo.time = nextMovementTimestampMs();
|
||||
if (movementHandler_) {
|
||||
movementHandler_->isFalling_ = false;
|
||||
movementHandler_->fallStartMs_ = 0;
|
||||
movementHandler_->setFalling(false);
|
||||
movementHandler_->setFallStartMs(0);
|
||||
}
|
||||
movementInfo.fallTime = 0;
|
||||
movementInfo.jumpVelocity = 0.0f;
|
||||
|
|
@ -1945,8 +1944,8 @@ void GameHandler::interactWithGameObject(uint64_t guid) {
|
|||
if (guid == 0) { LOG_WARNING("[GO-DIAG] BLOCKED: guid==0"); return; }
|
||||
if (!isInWorld()) { LOG_WARNING("[GO-DIAG] BLOCKED: not in world"); return; }
|
||||
// Do not overlap an actual spell cast.
|
||||
if (spellHandler_ && spellHandler_->casting_ && spellHandler_->currentCastSpellId_ != 0) {
|
||||
LOG_WARNING("[GO-DIAG] BLOCKED: already casting spellId=", spellHandler_->currentCastSpellId_);
|
||||
if (spellHandler_ && spellHandler_->isCasting() && spellHandler_->getCurrentCastSpellId() != 0) {
|
||||
LOG_WARNING("[GO-DIAG] BLOCKED: already casting spellId=", spellHandler_->getCurrentCastSpellId());
|
||||
return;
|
||||
}
|
||||
// Always clear melee intent before GO interactions.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue