mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 00:21:38 +00:00
- for initializing tab commands a separate static lookup function must be used to get the button names.
Because order of initialization for static objects is undefined.
This commit is contained in:
parent
570696fc09
commit
8d089a11fa
2 changed files with 12 additions and 1 deletions
|
@ -128,6 +128,15 @@ static const ButtonDesc gamefuncs[] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This is for use by the tab command builder which can run before the optimized tables are initialized.
|
||||||
|
const char* StaticGetButtonName(int32_t func)
|
||||||
|
{
|
||||||
|
for (auto& entry : gamefuncs)
|
||||||
|
if (entry.index == func) return entry.name;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
|
|
|
@ -432,6 +432,8 @@ FConsoleCommand* FConsoleCommand::FindByName (const char* name)
|
||||||
return FindNameInHashTable (Commands, name, strlen (name));
|
return FindNameInHashTable (Commands, name, strlen (name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* StaticGetButtonName(int32_t func);
|
||||||
|
|
||||||
FConsoleCommand::FConsoleCommand (const char *name, CCmdRun runFunc)
|
FConsoleCommand::FConsoleCommand (const char *name, CCmdRun runFunc)
|
||||||
: m_RunFunc (runFunc)
|
: m_RunFunc (runFunc)
|
||||||
{
|
{
|
||||||
|
@ -446,7 +448,7 @@ FConsoleCommand::FConsoleCommand (const char *name, CCmdRun runFunc)
|
||||||
// Add all the action commands for tab completion
|
// Add all the action commands for tab completion
|
||||||
for (i = 0; i < buttonMap.NumButtons(); i++)
|
for (i = 0; i < buttonMap.NumButtons(); i++)
|
||||||
{
|
{
|
||||||
FString tname = "+"; tname << buttonMap.GetButtonName(i);
|
FString tname = "+"; tname << StaticGetButtonName(i);
|
||||||
C_AddTabCommand (tname);
|
C_AddTabCommand (tname);
|
||||||
tname.Substitute('+', '-');
|
tname.Substitute('+', '-');
|
||||||
C_AddTabCommand (tname);
|
C_AddTabCommand (tname);
|
||||||
|
|
Loading…
Reference in a new issue