mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-12 06:48:04 +03:00
Cleaned up some code, added comments
This commit is contained in:
parent
86b1021f45
commit
7695d24a50
@ -868,18 +868,31 @@ void C_MessageEnd_Post(void) {
|
||||
if (endfunction) (*endfunction)(NULL);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
const char *C_Cmd_Args( void ) {
|
||||
if (g_fakecmd.fake) RETURN_META_VALUE(MRES_SUPERCEDE, (g_fakecmd.argc>1)?g_fakecmd.args:NULL);
|
||||
|
||||
const char *C_Cmd_Args( void )
|
||||
{
|
||||
// if the global "fake" flag is set, which means that engclient_cmd was used, supercede the function
|
||||
if (g_fakecmd.fake)
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, (g_fakecmd.argc > 1) ? g_fakecmd.args : NULL);
|
||||
// otherwise ignore it
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
const char *C_Cmd_Argv( int argc ) {
|
||||
if (g_fakecmd.fake) RETURN_META_VALUE(MRES_SUPERCEDE, (argc<3)?g_fakecmd.argv[argc]:"");
|
||||
const char *C_Cmd_Argv(int argc)
|
||||
{
|
||||
// if the global "fake" flag is set, which means that engclient_cmd was used, supercede the function
|
||||
if (g_fakecmd.fake)
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, (argc < 3) ? g_fakecmd.argv[argc] : "");
|
||||
// otherwise ignore it
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
int C_Cmd_Argc( void ) {
|
||||
if (g_fakecmd.fake) RETURN_META_VALUE(MRES_SUPERCEDE, g_fakecmd.argc );
|
||||
int C_Cmd_Argc( void )
|
||||
{
|
||||
// if the global "fake" flag is set, which means that engclient_cmd was used, supercede the function
|
||||
if (g_fakecmd.fake)
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, g_fakecmd.argc);
|
||||
// otherwise ignore it
|
||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||
}
|
||||
|
||||
@ -903,9 +916,10 @@ void C_TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...) {
|
||||
|
||||
if ( atype != at_logged ) RETURN_META(MRES_IGNORED);
|
||||
void C_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
|
||||
{
|
||||
if (atype != at_logged)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
|
||||
/* There are also more messages but we want only logs
|
||||
at_notice,
|
||||
@ -916,52 +930,19 @@ void C_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...) {
|
||||
at_logged // Server print to console ( only in multiplayer games ).
|
||||
*/
|
||||
|
||||
// execute logevents and plugin_log forward
|
||||
if (g_logevents.logEventsExist() || FF_PluginLog >= 0)
|
||||
{
|
||||
va_list logArgPtr;
|
||||
va_start ( logArgPtr , szFmt );
|
||||
g_logevents.setLogString( szFmt , logArgPtr );
|
||||
va_end ( logArgPtr );
|
||||
g_logevents.parseLogString( );
|
||||
if (g_logevents.logEventsExist())
|
||||
{
|
||||
va_list logArgPtr;
|
||||
va_start ( logArgPtr , szFmt );
|
||||
g_logevents.setLogString( szFmt , logArgPtr );
|
||||
va_end ( logArgPtr );
|
||||
g_logevents.parseLogString( );
|
||||
g_logevents.executeLogEvents( );
|
||||
|
||||
|
||||
#if 0 // ######### this is done by call above
|
||||
LogEventsMngr::iterator a = g_logevents.begin();
|
||||
int err;
|
||||
#ifdef ENABLEEXEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
while ( a )
|
||||
{
|
||||
if ((err = amx_Exec((*a).getPlugin()->getAMX(), NULL , (*a).getFunction() , 1,mPlayerIndex)) != AMX_ERR_NONE)
|
||||
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")",err,(*a).getPlugin()->getAMX()->curline,(*a).getPlugin()->getName());
|
||||
|
||||
++a;
|
||||
|
||||
}
|
||||
|
||||
#ifdef ENABLEEXEPTIONS
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
AMXXLOG_Log( "[AMXX] fatal error at log event execution");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
executeForwards(FF_PluginLog);
|
||||
}
|
||||
else if (FF_PluginLog >= 0)
|
||||
{
|
||||
va_list logArgPtr;
|
||||
va_start ( logArgPtr , szFmt );
|
||||
g_logevents.setLogString( szFmt , logArgPtr );
|
||||
va_end ( logArgPtr );
|
||||
g_logevents.parseLogString( );
|
||||
executeForwards(FF_PluginLog);
|
||||
}
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user