mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-12 06:48:04 +03:00
Fixed FormatAmxString bugs
This commit is contained in:
parent
eadd0a8317
commit
5469f70dba
@ -317,11 +317,16 @@ void CLangMngr::CLang::Dump()
|
|||||||
|
|
||||||
const char * CLangMngr::CLang::GetDef(const char *key)
|
const char * CLangMngr::CLang::GetDef(const char *key)
|
||||||
{
|
{
|
||||||
|
static char nfind[1024];
|
||||||
uint32_t hash = MakeHash(key, true);
|
uint32_t hash = MakeHash(key, true);
|
||||||
for (LookUpVecIter iter = m_LookUpTable.begin(); iter != m_LookUpTable.end(); ++iter)
|
for (LookUpVecIter iter = m_LookUpTable.begin(); iter != m_LookUpTable.end(); ++iter)
|
||||||
|
{
|
||||||
|
AMXXLOG_Log( "Lookup: %s", (*iter).GetKey() );
|
||||||
if (*iter == hash)
|
if (*iter == hash)
|
||||||
return iter->GetDef();
|
return iter->GetDef();
|
||||||
return "(not found)";
|
}
|
||||||
|
sprintf(nfind, "ML Lookup Failure: %s", key);
|
||||||
|
return nfind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -687,6 +692,9 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
char tmpString[256];
|
||||||
|
char *tmpPtr = tmpString;
|
||||||
|
int tmpLen =0;
|
||||||
char format[16];
|
char format[16];
|
||||||
format[0] = '%';
|
format[0] = '%';
|
||||||
char *ptr = format+1;
|
char *ptr = format+1;
|
||||||
@ -694,7 +702,33 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
/*nothing*/;
|
/*nothing*/;
|
||||||
--src;
|
--src;
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
sprintf(outptr, format, *get_amxaddr(amx, params[parm++]));
|
switch ( *(ptr-1) )
|
||||||
|
{
|
||||||
|
case 's':
|
||||||
|
{
|
||||||
|
cell *tmpCell = get_amxaddr(amx, params[parm++]);
|
||||||
|
while (*tmpCell)
|
||||||
|
*tmpPtr++ = *tmpCell++;
|
||||||
|
*tmpPtr = 0;
|
||||||
|
sprintf(outptr, format, tmpString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'f':
|
||||||
|
{
|
||||||
|
sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'd':
|
||||||
|
{
|
||||||
|
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'i':
|
||||||
|
{
|
||||||
|
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
outptr += strlen(outptr);
|
outptr += strlen(outptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ int C_Spawn( edict_t *pent ) {
|
|||||||
get_localinfo("amxx_customdir", "addons/amxx/custom");
|
get_localinfo("amxx_customdir", "addons/amxx/custom");
|
||||||
|
|
||||||
// ###### Load modules
|
// ###### Load modules
|
||||||
loadModules(get_localinfo("amxx_modules", "addons/amxx/modules.ini"));
|
loadModules(get_localinfo("amxx_modules", "addons/amxx/configs/modules.ini"));
|
||||||
attachModules();
|
attachModules();
|
||||||
int loaded = countModules(CountModules_Running); // Call after attachModules so all modules don't have pending stat
|
int loaded = countModules(CountModules_Running); // Call after attachModules so all modules don't have pending stat
|
||||||
// Set some info about amx version and modules
|
// Set some info about amx version and modules
|
||||||
@ -268,7 +268,7 @@ int C_Spawn( edict_t *pent ) {
|
|||||||
memset(g_players[0].flags,-1,sizeof(g_players[0].flags));
|
memset(g_players[0].flags,-1,sizeof(g_players[0].flags));
|
||||||
|
|
||||||
// ###### Load AMX scripts
|
// ###### Load AMX scripts
|
||||||
g_plugins.loadPluginsFromFile( get_localinfo("amxx_plugins", "addons/amxx/plugins.ini") );
|
g_plugins.loadPluginsFromFile( get_localinfo("amxx_plugins", "addons/amxx/configs/plugins.ini") );
|
||||||
|
|
||||||
// Register forwards
|
// Register forwards
|
||||||
FF_PluginInit = registerForward("plugin_init", ET_IGNORE, FP_DONE);
|
FF_PluginInit = registerForward("plugin_init", ET_IGNORE, FP_DONE);
|
||||||
@ -1064,7 +1064,7 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
|
|||||||
|
|
||||||
// ###### Now attach metamod modules
|
// ###### Now attach metamod modules
|
||||||
// This will also call modules Meta_Query and Meta_Attach functions
|
// This will also call modules Meta_Query and Meta_Attach functions
|
||||||
attachMetaModModules(now, get_localinfo("amxx_modules", "addons/amxx/modules.ini") );
|
attachMetaModModules(now, get_localinfo("amxx_modules", "addons/amxx/configs/modules.ini") );
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user