1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-12-01 13:24:25 +01:00
HLMetaModOfficial/sourcemm/util.h
Scott Ehlert 8ce6594b70 Semi-small fix to make SourceMM ignore whitespace in metaplugins.ini with UTIL_TrimLeft and UTIL_TrimRight
(I'm not sure if I'm qualified to make efficient string functions here, so um, they probably are pretty bad)

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4085
2005-07-03 16:11:28 +00:00

51 lines
1.1 KiB
C

/* ======== SourceMM ========
* Copyright (C) 2004-2005 Metamod:Source Development Team
* No warranties of any kind
*
* License: zlib/libpng
*
* Author(s): David "BAILOPAN" Anderson
* ============================
*/
#ifndef _INCLUDE_UTIL_H
#define _INCLUDE_UTIL_H
/**
* @brief Utility functons
* @file util.h
*/
const char *UTIL_GetExtension(const char *file);
void UTIL_TrimLeft(char *buffer);
void UTIL_TrimRight(char *buffer);
#define META_INTERFACE_MACRO(type, final) \
PluginIter i; \
void *mret=NULL, *d; \
META_RES mres, high=MRES_IGNORED; \
g_SmmAPI.SetLastMetaReturn(MRES_IGNORED); \
for (i=g_PluginMngr._begin(); i!=g_PluginMngr._end(); i++) \
{ \
if ( (*i) && (*i)->fac_list. type ) \
{ \
d = ((*i)->fac_list. type)(name, ret); \
mres = g_SmmAPI.GetLastMetaReturn(); \
if (mres > high) \
high = mres; \
if (mres >= MRES_OVERRIDE) \
mret = d; \
} \
} \
if (high == MRES_OVERRIDE) \
{ \
(final)(name, ret); \
return mret; \
} else if (high == MRES_SUPERCEDE) { \
return mret; \
} else { \
return (final)(name, ret); \
}
#endif //_INCLUDE_UTIL_H