mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-26 16:50:15 +00:00
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:
parent
a0267e6e95
commit
ea15740e17
2 changed files with 15 additions and 22 deletions
|
|
@ -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)>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue