mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix: Only allow changing dummy when dummy is connected
This commit is contained in:
parent
9f509eeedb
commit
474d307a9a
|
@ -210,10 +210,12 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
|
||||||
UI()->DoLabelScaled(&Label, aBuf, 14.0, -1);
|
UI()->DoLabelScaled(&Label, aBuf, 14.0, -1);
|
||||||
static float s_OffsetName = 0.0f;
|
static float s_OffsetName = 0.0f;
|
||||||
if(DoEditBox(Name, &Button, Name, sizeof(g_Config.m_PlayerName), 14.0f, &s_OffsetName))
|
if(DoEditBox(Name, &Button, Name, sizeof(g_Config.m_PlayerName), 14.0f, &s_OffsetName))
|
||||||
|
{
|
||||||
if(s_Dummy)
|
if(s_Dummy)
|
||||||
m_NeedSendDummyinfo = true;
|
m_NeedSendDummyinfo = true;
|
||||||
else
|
else
|
||||||
m_NeedSendinfo = true;
|
m_NeedSendinfo = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Dummy Settings"), s_Dummy, &Dummy))
|
if(DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Dummy Settings"), s_Dummy, &Dummy))
|
||||||
{
|
{
|
||||||
|
@ -229,10 +231,12 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
|
||||||
UI()->DoLabelScaled(&Label, aBuf, 14.0, -1);
|
UI()->DoLabelScaled(&Label, aBuf, 14.0, -1);
|
||||||
static float s_OffsetClan = 0.0f;
|
static float s_OffsetClan = 0.0f;
|
||||||
if(DoEditBox(Clan, &Button, Clan, sizeof(g_Config.m_PlayerClan), 14.0f, &s_OffsetClan))
|
if(DoEditBox(Clan, &Button, Clan, sizeof(g_Config.m_PlayerClan), 14.0f, &s_OffsetClan))
|
||||||
|
{
|
||||||
if(s_Dummy)
|
if(s_Dummy)
|
||||||
m_NeedSendDummyinfo = true;
|
m_NeedSendDummyinfo = true;
|
||||||
else
|
else
|
||||||
m_NeedSendinfo = true;
|
m_NeedSendinfo = true;
|
||||||
|
}
|
||||||
|
|
||||||
// country flag selector
|
// country flag selector
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
|
|
|
@ -243,6 +243,8 @@ void CGameClient::OnConsoleInit()
|
||||||
Console()->Chain("dummy_color_feet", ConchainSpecialDummyInfoupdate, this);
|
Console()->Chain("dummy_color_feet", ConchainSpecialDummyInfoupdate, this);
|
||||||
Console()->Chain("dummy_skin", ConchainSpecialDummyInfoupdate, this);
|
Console()->Chain("dummy_skin", ConchainSpecialDummyInfoupdate, this);
|
||||||
|
|
||||||
|
Console()->Chain("cl_dummy", ConchainSpecialDummy, this);
|
||||||
|
|
||||||
//
|
//
|
||||||
m_SuppressEvents = false;
|
m_SuppressEvents = false;
|
||||||
}
|
}
|
||||||
|
@ -555,6 +557,9 @@ void CGameClient::OnRender()
|
||||||
m_NewTick = false;
|
m_NewTick = false;
|
||||||
m_NewPredictedTick = false;
|
m_NewPredictedTick = false;
|
||||||
|
|
||||||
|
if(g_Config.m_ClDummy && !Client()->DummyConnected())
|
||||||
|
g_Config.m_ClDummy = 0;
|
||||||
|
|
||||||
// check if client info has to be resent
|
// check if client info has to be resent
|
||||||
if(m_LastSendInfo && Client()->State() == IClient::STATE_ONLINE && m_Snap.m_LocalClientID >= 0 && !m_pMenus->IsActive() && m_LastSendInfo+time_freq()*6 < time_get())
|
if(m_LastSendInfo && Client()->State() == IClient::STATE_ONLINE && m_Snap.m_LocalClientID >= 0 && !m_pMenus->IsActive() && m_LastSendInfo+time_freq()*6 < time_get())
|
||||||
{
|
{
|
||||||
|
@ -1406,6 +1411,14 @@ void CGameClient::ConchainSpecialDummyInfoupdate(IConsole::IResult *pResult, voi
|
||||||
((CGameClient*)pUserData)->SendDummyInfo(false);
|
((CGameClient*)pUserData)->SendDummyInfo(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGameClient::ConchainSpecialDummy(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||||
|
{
|
||||||
|
pfnCallback(pResult, pCallbackUserData);
|
||||||
|
if(pResult->NumArguments())
|
||||||
|
if(g_Config.m_ClDummy && !((CGameClient*)pUserData)->Client()->DummyConnected())
|
||||||
|
g_Config.m_ClDummy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
IGameClient *CreateGameClient()
|
IGameClient *CreateGameClient()
|
||||||
{
|
{
|
||||||
return &g_GameClient;
|
return &g_GameClient;
|
||||||
|
|
|
@ -68,6 +68,7 @@ class CGameClient : public IGameClient
|
||||||
|
|
||||||
static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
static void ConchainSpecialDummyInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
static void ConchainSpecialDummyInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
|
static void ConchainSpecialDummy(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IKernel *Kernel() { return IInterface::Kernel(); }
|
IKernel *Kernel() { return IInterface::Kernel(); }
|
||||||
|
|
Loading…
Reference in a new issue