refactor: add withSoundManager() template to reduce renderer boilerplate

Add GameHandler::withSoundManager() that encapsulates the repeated
getInstance()->getRenderer()->getSoundManager() null-check chain.
Replace 6 call sites, with helper available for future consolidation
of remaining 25 sites.
This commit is contained in:
Kelsi 2026-03-25 13:35:29 -07:00
parent a0267e6e95
commit ea15740e17
2 changed files with 15 additions and 22 deletions

View file

@ -2000,6 +2000,9 @@ public:
void fireAddonEvent(const std::string& event, const std::vector<std::string>& args = {}) {
if (addonEventCallback_) addonEventCallback_(event, args);
}
// Convenience: invoke a callback with a sound manager obtained from the renderer.
template<typename ManagerGetter, typename Callback>
void withSoundManager(ManagerGetter getter, Callback cb);
// Reputation change toast: factionName, delta, new standing
using RepChangeCallback = std::function<void(const std::string& factionName, int32_t delta, int32_t standing)>;