From 0e6aaeb44ec15dbc50157c1757c615e1c987c741 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 31 Mar 2026 20:11:28 +0300 Subject: [PATCH] fix warnings, remove phases from commentaries --- include/game/entity_controller.hpp | 38 ++++++++++++------------------ include/game/game_handler.hpp | 24 ++++--------------- include/game/world_packets.hpp | 14 +++++------ src/game/entity_controller.cpp | 4 ++-- src/ui/action_bar_panel.cpp | 2 +- src/ui/chat_panel.cpp | 6 ++--- 6 files changed, 33 insertions(+), 55 deletions(-) diff --git a/include/game/entity_controller.hpp b/include/game/entity_controller.hpp index ee63504c..17af614b 100644 --- a/include/game/entity_controller.hpp +++ b/include/game/entity_controller.hpp @@ -143,28 +143,25 @@ private: void applyUpdateObjectBlock(const UpdateBlock& block, bool& newItemCreated); void finalizeUpdateObjectBatch(bool newItemCreated); - // --- Phase 1: Extracted helper methods --- bool extractPlayerAppearance(const std::map& fields, uint8_t& outRace, uint8_t& outGender, uint32_t& outAppearanceBytes, uint8_t& outFacial) const; void maybeDetectCoinageIndex(const std::map& oldFields, const std::map& newFields); - // --- Phase 2: Update type handlers --- void handleCreateObject(const UpdateBlock& block, bool& newItemCreated); void handleValuesUpdate(const UpdateBlock& block); void handleMovementUpdate(const UpdateBlock& block); - // --- Phase 3: Concern-specific helpers --- - // 3i: Update transport-relative child attachment (non-player entities). + // Update transport-relative child attachment (non-player entities). // Consolidates identical logic from CREATE/VALUES/MOVEMENT handlers. void updateNonPlayerTransportAttachment(const UpdateBlock& block, const std::shared_ptr& entity, ObjectType entityType); - // 3f: Rebuild playerAuras_ from UNIT_FIELD_AURAS (Classic/vanilla only). + // Rebuild playerAuras_ from UNIT_FIELD_AURAS (Classic/vanilla only). // Consolidates identical logic from CREATE and VALUES handlers. void syncClassicAurasFromFields(const std::shared_ptr& entity); - // 3h: Detect mount/dismount from UNIT_FIELD_MOUNTDISPLAYID changes (self-player only). + // Detect mount/dismount from UNIT_FIELD_MOUNTDISPLAYID changes (self-player only). // Consolidates identical logic from CREATE and VALUES handlers. void detectPlayerMountChange(uint32_t newMountDisplayId, const std::map& blockFields); @@ -172,7 +169,6 @@ private: // Shared player-death handler: caches corpse position, sets death state. void markPlayerDead(const char* source); - // --- Phase 4: Field index cache structs --- // Cached field indices resolved once per handler call to avoid repeated lookups. struct UnitFieldIndices { uint16_t health, maxHealth, powerBase, maxPowerBase; @@ -202,44 +198,42 @@ private: uint32_t oldDisplayId = 0; }; - // --- Phase 3: Extracted concern-specific helpers (continued) --- - // 3a: Entity factory — creates the correct Entity subclass for the given block. + // Entity factory — creates the correct Entity subclass for the given block. std::shared_ptr createEntityFromBlock(const UpdateBlock& block); - // 3b: Track player-on-transport state from movement blocks. + // Track player-on-transport state from movement blocks. void applyPlayerTransportState(const UpdateBlock& block, const std::shared_ptr& entity, const glm::vec3& canonicalPos, float oCanonical, bool updateMovementInfoPos); - // 3c: Apply unit fields during CREATE — returns true if entity is initially dead. + // Apply unit fields during CREATE — returns true if entity is initially dead. bool applyUnitFieldsOnCreate(const UpdateBlock& block, std::shared_ptr& unit, const UnitFieldIndices& ufi); - // 3c: Apply unit fields during VALUES — returns change tracking result. + // Apply unit fields during VALUES — returns change tracking result. UnitFieldUpdateResult applyUnitFieldsOnUpdate(const UpdateBlock& block, const std::shared_ptr& entity, std::shared_ptr& unit, const UnitFieldIndices& ufi); - // 3d: Apply player stat fields (XP, inventory, skills, etc.). isCreate=true for CREATE path. + // Apply player stat fields (XP, inventory, skills, etc.). isCreate=true for CREATE path. bool applyPlayerStatFields(const std::map& fields, const PlayerFieldIndices& pfi, bool isCreate); - // 3e: Dispatch spawn callbacks (creature/player) — deduplicates CREATE and VALUES paths. + // Dispatch spawn callbacks (creature/player) — deduplicates CREATE and VALUES paths. void dispatchEntitySpawn(uint64_t guid, ObjectType objectType, const std::shared_ptr& entity, const std::shared_ptr& unit, bool isDead); - // 3g: Track item/container on CREATE. + // Track item/container on CREATE. void trackItemOnCreate(const UpdateBlock& block, bool& newItemCreated); - // 3g: Update item fields on VALUES update. + // Update item fields on VALUES update. void updateItemOnValuesUpdate(const UpdateBlock& block, const std::shared_ptr& entity); - // --- Phase 5: Strategy pattern — object-type handler interface --- // Allows extending object-type handling without modifying handler dispatch. struct IObjectTypeHandler { virtual ~IObjectTypeHandler() = default; - virtual void onCreate(const UpdateBlock& block, std::shared_ptr& entity, - bool& newItemCreated) {} - virtual void onValuesUpdate(const UpdateBlock& block, std::shared_ptr& entity) {} - virtual void onMovementUpdate(const UpdateBlock& block, std::shared_ptr& entity) {} + virtual void onCreate(const UpdateBlock& /*block*/, std::shared_ptr& /*entity*/, + bool& /*newItemCreated*/) {} + virtual void onValuesUpdate(const UpdateBlock& /*block*/, std::shared_ptr& /*entity*/) {} + virtual void onMovementUpdate(const UpdateBlock& /*block*/, std::shared_ptr& /*entity*/) {} }; struct UnitTypeHandler; struct PlayerTypeHandler; @@ -250,7 +244,6 @@ private: void initTypeHandlers(); IObjectTypeHandler* getTypeHandler(ObjectType type) const; - // --- Phase 5: Type-specific handler implementations (trampolined from handlers) --- void onCreateUnit(const UpdateBlock& block, std::shared_ptr& entity); void onCreatePlayer(const UpdateBlock& block, std::shared_ptr& entity); void onCreateGameObject(const UpdateBlock& block, std::shared_ptr& entity); @@ -265,7 +258,6 @@ private: void onValuesUpdateItem(const UpdateBlock& block, std::shared_ptr& entity); void onValuesUpdateGameObject(const UpdateBlock& block, std::shared_ptr& entity); - // --- Phase 6: Deferred event bus --- // Collects addon events during block processing, flushes at the end. struct PendingEvents { std::vector>> events; diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 1f68c834..b6c86794 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -627,7 +627,6 @@ public: void resetWardenState(); // clear all warden module/crypto state for connect/disconnect void clearUnitCaches(); // clear per-unit cast states and aura caches - // ---- Phase 1: Name queries (delegated to EntityController) ---- void queryPlayerName(uint64_t guid); void queryCreatureInfo(uint32_t entry, uint64_t guid); void queryGameObjectInfo(uint32_t entry, uint64_t guid); @@ -661,7 +660,6 @@ public: return entityController_->getCreatureFamily(entry); } - // ---- Phase 2: Combat (delegated to CombatHandler) ---- void startAutoAttack(uint64_t targetGuid); void stopAutoAttack(); bool isAutoAttacking() const; @@ -696,7 +694,6 @@ public: const std::vector* getThreatList(uint64_t unitGuid) const; const std::vector* getTargetThreatList() const; - // ---- Phase 3: Spells ---- void castSpell(uint32_t spellId, uint64_t targetGuid = 0); void cancelCast(); void cancelAura(uint32_t spellId); @@ -1239,7 +1236,7 @@ public: void acceptResurrect(); void declineResurrect(); - // ---- Phase 4: Group ---- + // ---- Group ---- void inviteToGroup(const std::string& playerName); void acceptGroupInvite(); void declineGroupInvite(); @@ -1396,7 +1393,7 @@ public: return nullptr; } - // ---- Phase 5: Loot ---- + // ---- Loot ---- void lootTarget(uint64_t guid); void lootItem(uint8_t slotIndex); void closeLoot(); @@ -2177,7 +2174,6 @@ private: */ void handlePong(network::Packet& packet); - // ---- Phase 1 handlers (entity queries delegated to EntityController) ---- void handleItemQueryResponse(network::Packet& packet); void queryItemInfo(uint32_t entry, uint64_t guid); void rebuildOnlineInventory(); @@ -2190,7 +2186,6 @@ private: void extractContainerFields(uint64_t containerGuid, const std::map& fields); uint64_t resolveOnlineItemGuid(uint32_t itemId) const; - // ---- Phase 2 handlers (dead — dispatched via CombatHandler) ---- // handleAttackStart, handleAttackStop, handleAttackerStateUpdate, // handleSpellDamageLog, handleSpellHealLog removed @@ -2198,12 +2193,6 @@ private: void handleUpdateAuraDuration(uint8_t slot, uint32_t durationMs); // handleSetForcedReactions — dispatched via CombatHandler - // ---- Phase 3 handlers ---- - - // ---- Talent handlers ---- - - // ---- Phase 4 handlers ---- - // ---- Guild handlers ---- void handlePetSpells(network::Packet& packet); @@ -2217,7 +2206,6 @@ private: // ---- Other player movement (MSG_MOVE_* from server) ---- - // ---- Phase 5 handlers ---- void clearPendingQuestAccept(uint32_t questId); void triggerQuestAcceptResync(uint32_t questId, uint64_t npcGuid, const char* reason); bool hasQuestInLog(uint32_t questId) const; @@ -2411,7 +2399,6 @@ private: uint32_t homeBindZoneId_ = 0; glm::vec3 homeBindPos_{0.0f}; - // ---- Phase 1: Name caches (moved to EntityController) ---- // ---- Friend/contact list cache ---- std::unordered_map friendsCache; // name -> guid @@ -2510,11 +2497,10 @@ private: std::unordered_set pendingAutoInspect_; float inspectRateLimit_ = 0.0f; - // ---- Phase 2: Combat (state moved to CombatHandler) ---- + // ---- Combat ---- bool wasCombat_ = false; // Previous frame combat state for PLAYER_REGEN edge detection std::deque areaTriggerMsgs_; - // ---- Phase 3: Spells ---- WorldEntryCallback worldEntryCallback_; KnockBackCallback knockBackCallback_; CameraShakeCallback cameraShakeCallback_; @@ -2674,7 +2660,7 @@ private: void loadFactionNameCache() const; std::string getFactionName(uint32_t factionId) const; - // ---- Phase 4: Group ---- + // ---- Group ---- GroupListData partyData; bool pendingGroupInvite = false; std::string pendingInviterName; @@ -2745,7 +2731,7 @@ private: // Barber shop bool barberShopOpen_ = false; - // ---- Phase 5: Loot ---- + // ---- Loot ---- bool lootWindowOpen = false; bool autoLoot_ = false; bool autoSellGrey_ = false; diff --git a/include/game/world_packets.hpp b/include/game/world_packets.hpp index a8be1060..d0f98577 100644 --- a/include/game/world_packets.hpp +++ b/include/game/world_packets.hpp @@ -1460,7 +1460,7 @@ public: }; // ============================================================ -// Phase 1: Foundation — Targeting, Name Queries +// Foundation — Targeting, Name Queries // ============================================================ /** CMSG_SET_SELECTION packet builder */ @@ -1663,7 +1663,7 @@ public: }; // ============================================================ -// Phase 2: Combat Core +// Combat Core // ============================================================ /** SMSG_MONSTER_MOVE data */ @@ -1805,7 +1805,7 @@ public: }; // ============================================================ -// Phase 3: Spells, Action Bar, Auras +// Spells, Action Bar, Auras // ============================================================ /** SMSG_INITIAL_SPELLS data */ @@ -1930,7 +1930,7 @@ public: }; // ============================================================ -// Phase 4: Group/Party System +// Group/Party System // ============================================================ /** CMSG_GROUP_INVITE packet builder */ @@ -1998,7 +1998,7 @@ public: }; // ============================================================ -// Phase 5: Loot System +// Loot System // ============================================================ /** Loot item entry */ @@ -2100,7 +2100,7 @@ public: }; // ============================================================ -// Phase 5: NPC Gossip +// NPC Gossip // ============================================================ /** Gossip menu option */ @@ -2278,7 +2278,7 @@ public: }; // ============================================================ -// Phase 5: Vendor +// Vendor // ============================================================ /** Vendor item entry */ diff --git a/src/game/entity_controller.cpp b/src/game/entity_controller.cpp index 6f74f46e..6a9cc826 100644 --- a/src/game/entity_controller.cpp +++ b/src/game/entity_controller.cpp @@ -1266,14 +1266,14 @@ struct EntityController::GameObjectTypeHandler : EntityController::IObjectTypeHa struct EntityController::ItemTypeHandler : EntityController::IObjectTypeHandler { EntityController& ctl_; explicit ItemTypeHandler(EntityController& c) : ctl_(c) {} - void onCreate(const UpdateBlock& block, std::shared_ptr& entity, bool& newItemCreated) override { ctl_.onCreateItem(block, newItemCreated); } + void onCreate(const UpdateBlock& block, std::shared_ptr& /*entity*/, bool& newItemCreated) override { ctl_.onCreateItem(block, newItemCreated); } void onValuesUpdate(const UpdateBlock& block, std::shared_ptr& entity) override { ctl_.onValuesUpdateItem(block, entity); } }; struct EntityController::CorpseTypeHandler : EntityController::IObjectTypeHandler { EntityController& ctl_; explicit CorpseTypeHandler(EntityController& c) : ctl_(c) {} - void onCreate(const UpdateBlock& block, std::shared_ptr& entity, bool&) override { ctl_.onCreateCorpse(block); } + void onCreate(const UpdateBlock& block, std::shared_ptr& /*entity*/, bool&) override { ctl_.onCreateCorpse(block); } }; // ============================================================ diff --git a/src/ui/action_bar_panel.cpp b/src/ui/action_bar_panel.cpp index 59873507..7ab39af4 100644 --- a/src/ui/action_bar_panel.cpp +++ b/src/ui/action_bar_panel.cpp @@ -1191,7 +1191,7 @@ void ActionBarPanel::renderStanceBar(game::GameHandler& gameHandler, } void ActionBarPanel::renderBagBar(game::GameHandler& gameHandler, - SettingsPanel& settingsPanel, + SettingsPanel& /*settingsPanel*/, InventoryScreen& inventoryScreen) { ImVec2 displaySize = ImGui::GetIO().DisplaySize; float screenW = displaySize.x > 0.0f ? displaySize.x : 1280.0f; diff --git a/src/ui/chat_panel.cpp b/src/ui/chat_panel.cpp index eb5f68dc..8a6d0ef3 100644 --- a/src/ui/chat_panel.cpp +++ b/src/ui/chat_panel.cpp @@ -2110,9 +2110,9 @@ std::unordered_map s_castSeqStates; void ChatPanel::sendChatMessage(game::GameHandler& gameHandler, - InventoryScreen& inventoryScreen, - SpellbookScreen& spellbookScreen, - QuestLogScreen& questLogScreen) { + InventoryScreen& /*inventoryScreen*/, + SpellbookScreen& /*spellbookScreen*/, + QuestLogScreen& /*questLogScreen*/) { if (strlen(chatInputBuffer_) > 0) { std::string input(chatInputBuffer_);