mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Fixed bugs
This commit is contained in:
parent
213694cccc
commit
3af9ae8927
@ -233,7 +233,6 @@ CLangMngr::CLang::LangEntry::LangEntry(int pKey, uint32_t defHash, const char *p
|
|||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
key = pKey;
|
key = pKey;
|
||||||
this->
|
|
||||||
m_DefHash = defHash;
|
m_DefHash = defHash;
|
||||||
m_pDef.assign(pDef);
|
m_pDef.assign(pDef);
|
||||||
}
|
}
|
||||||
@ -295,7 +294,7 @@ void CLangMngr::CLang::Clear()
|
|||||||
|
|
||||||
CLangMngr::CLang::LangEntry * CLangMngr::CLang::GetEntry(int pkey)
|
CLangMngr::CLang::LangEntry * CLangMngr::CLang::GetEntry(int pkey)
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0; i<m_LookUpTable.size(); i++)
|
for (i=0; i<m_LookUpTable.size(); i++)
|
||||||
{
|
{
|
||||||
@ -308,6 +307,7 @@ CLangMngr::CLang::LangEntry * CLangMngr::CLang::GetEntry(int pkey)
|
|||||||
LangEntry *e = new LangEntry(pkey);
|
LangEntry *e = new LangEntry(pkey);
|
||||||
e->SetKey(pkey);
|
e->SetKey(pkey);
|
||||||
m_LookUpTable.push_back(e);
|
m_LookUpTable.push_back(e);
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ void CLangMngr::CLang::MergeDefinitions(CQueue<sKeyDef*> &vec)
|
|||||||
const char * CLangMngr::CLang::GetDef(const char *key)
|
const char * CLangMngr::CLang::GetDef(const char *key)
|
||||||
{
|
{
|
||||||
static char nfind[1024] = "ML_NOTFOUND";
|
static char nfind[1024] = "ML_NOTFOUND";
|
||||||
int ikey = lman->GetKeyEntry(key);
|
int ikey = m_LMan->GetKeyEntry(key);
|
||||||
if (ikey == -1)
|
if (ikey == -1)
|
||||||
{
|
{
|
||||||
sprintf(nfind, "ML_NOTFOUND: %s", key);
|
sprintf(nfind, "ML_NOTFOUND: %s", key);
|
||||||
@ -642,17 +642,17 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
}
|
}
|
||||||
case 'L':
|
case 'L':
|
||||||
{
|
{
|
||||||
cell langName = params[parm];
|
cell langName = params[parm]; // "en" case (langName contains the address to the string)
|
||||||
cell *pLangName = get_amxaddr(amx, params[parm++]);
|
cell *pAmxLangName = get_amxaddr(amx, params[parm++]); // other cases
|
||||||
const char *cpLangName=NULL;
|
const char *cpLangName=NULL;
|
||||||
// Handle player ids (1-32) and server language
|
// Handle player ids (1-32) and server language
|
||||||
if (*pLangName == LANG_PLAYER)
|
if (*pAmxLangName == LANG_PLAYER) // LANG_PLAYER
|
||||||
*pLangName = m_CurGlobId;
|
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(m_CurGlobId)->pEdict, "lang");
|
||||||
if (*pLangName == LANG_SERVER)
|
else if (*pAmxLangName == LANG_SERVER) // LANG_SERVER
|
||||||
cpLangName = g_vault.get("server_language");
|
cpLangName = g_vault.get("server_language");
|
||||||
else if (*pLangName >= 1 && *pLangName <= 32)
|
else if (*pAmxLangName >= 1 && *pAmxLangName <= 32) // Direct Client Id
|
||||||
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(*pLangName)->pEdict, "lang");
|
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(*pAmxLangName)->pEdict, "lang");
|
||||||
else
|
else // Language Name
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
cpLangName = get_amxstring(amx, langName, 2, len);
|
cpLangName = get_amxstring(amx, langName, 2, len);
|
||||||
@ -664,7 +664,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
const char *def = GetDef(cpLangName, key);
|
const char *def = GetDef(cpLangName, key);
|
||||||
if (def == NULL)
|
if (def == NULL)
|
||||||
{
|
{
|
||||||
if (*pLangName != LANG_SERVER)
|
if (*pAmxLangName != LANG_SERVER)
|
||||||
{
|
{
|
||||||
def = GetDef(g_vault.get("server_language"), key);
|
def = GetDef(g_vault.get("server_language"), key);
|
||||||
}
|
}
|
||||||
@ -937,7 +937,11 @@ int CLangMngr::MergeDefinitionFile(const char *file)
|
|||||||
} // if !multiline
|
} // if !multiline
|
||||||
} //if - main
|
} //if - main
|
||||||
}
|
}
|
||||||
|
// merge last section
|
||||||
|
if (!Defq.empty())
|
||||||
|
{
|
||||||
|
MergeDefinitions(language, Defq);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user