mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #7249 from Robyt3/Gameclient-ConfigManager-Getter
Add `IConfigManager` getter to `CGameClient` and `CComponent`
This commit is contained in:
commit
708b263766
|
@ -11,6 +11,7 @@ class IStorage *CComponent::Storage() const { return m_pClient->Storage(); }
|
|||
class CUI *CComponent::UI() const { return m_pClient->UI(); }
|
||||
class ISound *CComponent::Sound() const { return m_pClient->Sound(); }
|
||||
class CRenderTools *CComponent::RenderTools() const { return m_pClient->RenderTools(); }
|
||||
class IConfigManager *CComponent::ConfigManager() const { return m_pClient->ConfigManager(); }
|
||||
class CConfig *CComponent::Config() const { return m_pClient->Config(); }
|
||||
class IConsole *CComponent::Console() const { return m_pClient->Console(); }
|
||||
class IDemoPlayer *CComponent::DemoPlayer() const { return m_pClient->DemoPlayer(); }
|
||||
|
|
|
@ -58,6 +58,10 @@ protected:
|
|||
* Get the render tools interface.
|
||||
*/
|
||||
class CRenderTools *RenderTools() const;
|
||||
/**
|
||||
* Get the config manager interface.
|
||||
*/
|
||||
class IConfigManager *ConfigManager() const;
|
||||
/**
|
||||
* Get the config interface.
|
||||
*/
|
||||
|
|
|
@ -250,10 +250,7 @@ void CBinds::SetDefaults()
|
|||
|
||||
void CBinds::OnConsoleInit()
|
||||
{
|
||||
// bindings
|
||||
IConfigManager *pConfigManager = Kernel()->RequestInterface<IConfigManager>();
|
||||
if(pConfigManager)
|
||||
pConfigManager->RegisterCallback(ConfigSaveCallback, this);
|
||||
ConfigManager()->RegisterCallback(ConfigSaveCallback, this);
|
||||
|
||||
Console()->Register("bind", "s[key] ?r[command]", CFGFLAG_CLIENT, ConBind, this, "Bind key to execute a command or view keybindings");
|
||||
Console()->Register("binds", "?s[key]", CFGFLAG_CLIENT, ConBinds, this, "Print command executed by this keybinding or all binds");
|
||||
|
|
|
@ -882,9 +882,7 @@ void CMenus::OnInit()
|
|||
|
||||
void CMenus::OnConsoleInit()
|
||||
{
|
||||
auto *pConfigManager = Kernel()->RequestInterface<IConfigManager>();
|
||||
if(pConfigManager != nullptr)
|
||||
pConfigManager->RegisterCallback(CMenus::ConfigSaveCallback, this);
|
||||
ConfigManager()->RegisterCallback(CMenus::ConfigSaveCallback, this);
|
||||
Console()->Register("add_favorite_skin", "s[skin_name]", CFGFLAG_CLIENT, Con_AddFavoriteSkin, this, "Add a skin as a favorite");
|
||||
Console()->Register("remove_favorite_skin", "s[skin_name]", CFGFLAG_CLIENT, Con_RemFavoriteSkin, this, "Remove a skin from the favorites");
|
||||
}
|
||||
|
|
|
@ -86,7 +86,8 @@ void CGameClient::OnConsoleInit()
|
|||
m_pClient = Kernel()->RequestInterface<IClient>();
|
||||
m_pTextRender = Kernel()->RequestInterface<ITextRender>();
|
||||
m_pSound = Kernel()->RequestInterface<ISound>();
|
||||
m_pConfig = Kernel()->RequestInterface<IConfigManager>()->Values();
|
||||
m_pConfigManager = Kernel()->RequestInterface<IConfigManager>();
|
||||
m_pConfig = m_pConfigManager->Values();
|
||||
m_pInput = Kernel()->RequestInterface<IInput>();
|
||||
m_pConsole = Kernel()->RequestInterface<IConsole>();
|
||||
m_pStorage = Kernel()->RequestInterface<IStorage>();
|
||||
|
|
|
@ -164,6 +164,7 @@ private:
|
|||
class ITextRender *m_pTextRender;
|
||||
class IClient *m_pClient;
|
||||
class ISound *m_pSound;
|
||||
class IConfigManager *m_pConfigManager;
|
||||
class CConfig *m_pConfig;
|
||||
class IConsole *m_pConsole;
|
||||
class IStorage *m_pStorage;
|
||||
|
@ -230,6 +231,7 @@ public:
|
|||
class ISound *Sound() const { return m_pSound; }
|
||||
class IInput *Input() const { return m_pInput; }
|
||||
class IStorage *Storage() const { return m_pStorage; }
|
||||
class IConfigManager *ConfigManager() const { return m_pConfigManager; }
|
||||
class CConfig *Config() const { return m_pConfig; }
|
||||
class IConsole *Console() { return m_pConsole; }
|
||||
class ITextRender *TextRender() const { return m_pTextRender; }
|
||||
|
|
Loading…
Reference in a new issue