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>
This commit is contained in:
Pavel Okhlopkov 2026-04-11 08:30:28 +03:00
parent 535cc20afe
commit de0383aa6b
32 changed files with 2198 additions and 1293 deletions

View file

@ -71,7 +71,7 @@ public:
std::unordered_map<uint32_t, uint32_t> macroPrimarySpellCache_;
size_t macroCacheSpellCount_ = 0;
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (Phase B singleton breaking)
void setServices(const UIServices& services) { services_ = services; }
private:

View file

@ -110,14 +110,14 @@ public:
/** Reset all chat settings to defaults. */
void restoreDefaults();
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (Phase B singleton breaking)
void setServices(const UIServices& services) { services_ = services; }
/** Replace $g/$G and $n/$N gender/name placeholders in quest/chat text. */
std::string replaceGenderPlaceholders(const std::string& text, game::GameHandler& gameHandler);
private:
// Section 3.5: Injected UI services (Phase B singleton breaking)
// Injected UI services (Phase B singleton breaking)
UIServices services_;
// ---- Chat input state ----

View file

@ -72,7 +72,7 @@ public:
void renderThreatWindow(game::GameHandler& gameHandler);
void renderBgScoreboard(game::GameHandler& gameHandler);
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (Phase B singleton breaking)
void setServices(const UIServices& services) { services_ = services; }
private:

View file

@ -35,11 +35,11 @@ public:
/// called in render() after reclaim corpse button
void renderLateDialogs(game::GameHandler& gameHandler);
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (Phase B singleton breaking)
void setServices(const UIServices& services) { services_ = services; }
private:
// Section 3.5: Injected UI services
// Injected UI services
UIServices services_;
// Common ImGui window flags for popup dialogs
static constexpr ImGuiWindowFlags kDialogFlags =

View file

@ -55,7 +55,7 @@ public:
// Dependency injection for extracted classes (Phase A singleton breaking)
void setAppearanceComposer(core::AppearanceComposer* ac) { appearanceComposer_ = ac; }
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (Phase B singleton breaking)
void setServices(const UIServices& services);
private:

View file

@ -73,7 +73,7 @@ public:
void renderInspectWindow(game::GameHandler& gameHandler,
InventoryScreen& inventoryScreen);
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (singleton breaking)
void setServices(const UIServices& services) { services_ = services; }
private:

View file

@ -41,7 +41,7 @@ public:
/// Fire achievement earned toast + sound
void triggerAchievementToast(uint32_t achievementId, std::string name = {});
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (Phase B singleton breaking)
void setServices(const UIServices& services) { services_ = services; }
// --- public state consumed by GameScreen for the golden burst overlay ---
@ -49,7 +49,7 @@ public:
uint32_t levelUpDisplayLevel = 0;
private:
// Section 3.5: Injected UI services
// Injected UI services
UIServices services_;
// ---- Ding effect (own level-up) ----

View file

@ -75,7 +75,7 @@ public:
if (gameScreen) gameScreen->setAppearanceComposer(ac);
}
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (Phase B singleton breaking)
void setServices(const UIServices& services) {
services_ = services;
if (gameScreen) gameScreen->setServices(services);
@ -86,7 +86,7 @@ public:
private:
core::Window* window = nullptr;
UIServices services_; // Section 3.5: Injected services
UIServices services_; // Injected services
// UI Screens
std::unique_ptr<AuthScreen> authScreen;

View file

@ -23,7 +23,7 @@ namespace ui {
/**
* UI Services - Dependency injection container for UI components.
*
* Section 3.5: Break the singleton Phase B
* Break the singleton Phase B
*
* Replaces Application::getInstance() calls throughout UI code.
* Application creates this struct and injects it into UIManager,

View file

@ -174,7 +174,7 @@ public:
std::unordered_map<uint32_t, ExtendedCostEntry> extendedCostCache_;
bool extendedCostDbLoaded_ = false;
// Section 3.5: UIServices injection (Phase B singleton breaking)
// UIServices injection (Phase B singleton breaking)
void setServices(const UIServices& services) { services_ = services; }
private: