mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Add CTuningParams::PossibleTunings
to find tune params by name
This commit is contained in:
parent
047c88d797
commit
6af8f46526
|
@ -48,6 +48,20 @@ bool CTuningParams::Get(const char *pName, float *pValue) const
|
|||
return false;
|
||||
}
|
||||
|
||||
int CTuningParams::PossibleTunings(const char *pStr, IConsole::FPossibleCallback pfnCallback, void *pUser)
|
||||
{
|
||||
int Index = 0;
|
||||
for(int i = 0; i < Num(); i++)
|
||||
{
|
||||
if(str_find_nocase(Name(i), pStr))
|
||||
{
|
||||
pfnCallback(Index, Name(i), pUser);
|
||||
Index++;
|
||||
}
|
||||
}
|
||||
return Index;
|
||||
}
|
||||
|
||||
float VelocityRamp(float Value, float Start, float Range, float Curvature)
|
||||
{
|
||||
if(Value < Start)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <engine/console.h>
|
||||
#include <engine/shared/protocol.h>
|
||||
#include <game/generated/protocol.h>
|
||||
|
||||
|
@ -64,6 +65,7 @@ public:
|
|||
bool Get(int Index, float *pValue) const;
|
||||
bool Get(const char *pName, float *pValue) const;
|
||||
static const char *Name(int Index) { return ms_apNames[Index]; }
|
||||
int PossibleTunings(const char *pStr, IConsole::FPossibleCallback pfnCallback = IConsole::EmptyPossibleCommandCallback, void *pUser = nullptr);
|
||||
};
|
||||
|
||||
inline void StrToInts(int *pInts, int Num, const char *pStr)
|
||||
|
|
Loading…
Reference in a new issue