mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-10 14:53:51 +00:00
Extract ~1,700 lines / 60+ inline [this]-capturing lambdas from the monolithic
Application::setupUICallbacks() into 7 focused callback handler classes following
the ToastManager/ChatPanel::setupCallbacks() pattern already in the codebase.
New handlers (include/core/ + src/core/):
- NPCInteractionCallbackHandler NPC greeting/farewell/vendor/aggro voice
- AudioCallbackHandler Music, positional sound, level-up, achievement, LFG
- EntitySpawnCallbackHandler Creature/player/GO spawn, despawn, move, state
- AnimationCallbackHandler Death, respawn, combat, emotes, charge, sprint, vehicle
- TransportCallbackHandler Mount, taxi, transport spawn/move
- WorldEntryCallbackHandler World entry, unstuck, hearthstone, bind point
- UIScreenCallbackHandler Auth, realm selection, char selection/creation/deletion
application.cpp: 4,462 → 2,791 lines (−1,671)
setupUICallbacks: ~1,700 → ~50 lines (thin orchestrator)
Deduplication:
resolveSoundEntryPath() — was 3× copy-paste of SoundEntries.dbc lookup
resolveNpcVoiceType() — was 4× copy-paste of display-ID→voice detection
precacheNearbyTiles() — was 3× copy-paste of 17×17 tile loop
4 helper lambdas — promoted to private methods on WorldEntryCallbackHandler
State migration out of Application:
charge* (6 vars) → AnimationCallbackHandler
hearth*/worldEntry*/taxi* → WorldEntryCallbackHandler
pendingCreatedCharacterName_ → UIScreenCallbackHandler
Bug fixes:
- Duplicate `namespace core {` in application.hpp caused wowee::std pollution
- AppState forward decl in ui_screen_callback_handler.hpp was at wrong scope
- world_loader.cpp accessed moved member vars directly via friend; now uses handler API
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
namespace wowee {
|
|
|
|
namespace ui { class UIManager; }
|
|
namespace game { class GameHandler; class ExpansionRegistry; }
|
|
namespace auth { class AuthHandler; }
|
|
namespace pipeline { class AssetManager; }
|
|
|
|
namespace core {
|
|
|
|
// Forward-declared in application.hpp
|
|
enum class AppState;
|
|
|
|
/// Handles authentication, realm selection, character selection/creation UI callbacks.
|
|
/// Owns pendingCreatedCharacterName_.
|
|
class UIScreenCallbackHandler {
|
|
public:
|
|
using SetStateFn = std::function<void(AppState)>;
|
|
|
|
UIScreenCallbackHandler(ui::UIManager& uiManager,
|
|
game::GameHandler& gameHandler,
|
|
auth::AuthHandler& authHandler,
|
|
game::ExpansionRegistry* expansionRegistry,
|
|
pipeline::AssetManager* assetManager,
|
|
SetStateFn setState);
|
|
|
|
void setupCallbacks();
|
|
|
|
private:
|
|
ui::UIManager& uiManager_;
|
|
game::GameHandler& gameHandler_;
|
|
auth::AuthHandler& authHandler_;
|
|
game::ExpansionRegistry* expansionRegistry_;
|
|
pipeline::AssetManager* assetManager_;
|
|
SetStateFn setState_;
|
|
|
|
std::string pendingCreatedCharacterName_; // Auto-select after character creation
|
|
};
|
|
|
|
} // namespace core
|
|
} // namespace wowee
|