mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Print incorrect tuning parameter name on error
This commit is contained in:
parent
54aff02286
commit
46ec2e0a24
|
@ -2552,15 +2552,18 @@ void CGameContext::ConTuneParam(IConsole::IResult *pResult, void *pUserData)
|
|||
const char *pParamName = pResult->GetString(0);
|
||||
float NewValue = pResult->GetFloat(1);
|
||||
|
||||
char aBuf[256];
|
||||
if(pSelf->Tuning()->Set(pParamName, NewValue))
|
||||
{
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "%s changed to %.2f", pParamName, NewValue);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", aBuf);
|
||||
pSelf->SendTuningParams(-1);
|
||||
}
|
||||
else
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", "No such tuning parameter");
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "No such tuning parameter: %s", pParamName);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", aBuf);
|
||||
}
|
||||
}
|
||||
|
||||
void CGameContext::ConToggleTuneParam(IConsole::IResult *pResult, void *pUserData)
|
||||
|
@ -2569,9 +2572,11 @@ void CGameContext::ConToggleTuneParam(IConsole::IResult *pResult, void *pUserDat
|
|||
const char *pParamName = pResult->GetString(0);
|
||||
float OldValue;
|
||||
|
||||
char aBuf[256];
|
||||
if(!pSelf->Tuning()->Get(pParamName, &OldValue))
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", "No such tuning parameter");
|
||||
str_format(aBuf, sizeof(aBuf), "No such tuning parameter: %s", pParamName);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", aBuf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2579,7 +2584,6 @@ void CGameContext::ConToggleTuneParam(IConsole::IResult *pResult, void *pUserDat
|
|||
|
||||
pSelf->Tuning()->Set(pParamName, NewValue);
|
||||
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "%s changed to %.2f", pParamName, NewValue);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", aBuf);
|
||||
pSelf->SendTuningParams(-1);
|
||||
|
@ -2614,15 +2618,17 @@ void CGameContext::ConTuneZone(IConsole::IResult *pResult, void *pUserData)
|
|||
|
||||
if(List >= 0 && List < NUM_TUNEZONES)
|
||||
{
|
||||
char aBuf[256];
|
||||
if(pSelf->TuningList()[List].Set(pParamName, NewValue))
|
||||
{
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "%s in zone %d changed to %.2f", pParamName, List, NewValue);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", aBuf);
|
||||
pSelf->SendTuningParams(-1, List);
|
||||
}
|
||||
else
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", "No such tuning parameter");
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "No such tuning parameter: %s", pParamName);
|
||||
}
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", aBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue