Kelsidavis-WoWee/include/ui/ui_services.hpp
Pavel Okhlopkov de0383aa6b refactor: extract spline math, consolidate packet parsing, decompose TransportManager
Extract CatmullRomSpline (include/math/spline.hpp, src/math/spline.cpp) as a
standalone, immutable, thread-safe spline module with O(log n) binary segment
search and fused position+tangent evaluation — replacing the duplicated O(n)
evalTimedCatmullRom/orientationFromTangent pair in TransportManager.

Consolidate 7 copies of spline packet parsing into shared functions in
game/spline_packet.{hpp,cpp}: parseMonsterMoveSplineBody (WotLK/TBC),
parseMonsterMoveSplineBodyVanilla, parseClassicMoveUpdateSpline,
parseWotlkMoveUpdateSpline, and decodePackedDelta. Named SplineFlag constants
replace magic hex literals throughout.

Extract TransportPathRepository (game/transport_path_repository.{hpp,cpp}) from
TransportManager — owns path data, DBC loading, and path inference. Paths stored
as PathEntry wrapping CatmullRomSpline + metadata (zOnly, fromDBC, worldCoords).
TransportManager reduced from ~1200 to ~500 lines, focused on transport lifecycle
and server sync.

Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
2026-04-11 08:30:28 +03:00

55 lines
1.6 KiB
C++

#pragma once
namespace wowee {
// Forward declarations
namespace core {
class Window;
class EntitySpawner;
class AppearanceComposer;
class WorldLoader;
}
namespace rendering { class Renderer; }
namespace pipeline { class AssetManager; }
namespace game {
class GameHandler;
class ExpansionRegistry;
}
namespace addons { class AddonManager; }
namespace audio { class AudioCoordinator; }
namespace ui {
/**
* UI Services - Dependency injection container for UI components.
*
* Break the singleton Phase B
*
* Replaces Application::getInstance() calls throughout UI code.
* Application creates this struct and injects it into UIManager,
* which propagates it to GameScreen and all child UI components.
*
* Owned by Application, shared as const pointers (non-owning).
*/
struct UIServices {
core::Window* window = nullptr;
rendering::Renderer* renderer = nullptr;
pipeline::AssetManager* assetManager = nullptr;
game::GameHandler* gameHandler = nullptr;
game::ExpansionRegistry* expansionRegistry = nullptr;
addons::AddonManager* addonManager = nullptr;
audio::AudioCoordinator* audioCoordinator = nullptr;
// Extracted classes (also available individually for Phase A compatibility)
core::EntitySpawner* entitySpawner = nullptr;
core::AppearanceComposer* appearanceComposer = nullptr;
core::WorldLoader* worldLoader = nullptr;
// Helper to check if core services are wired
bool isValid() const {
return window && renderer && assetManager && gameHandler;
}
};
} // namespace ui
} // namespace wowee