mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +03:00
Fixed GCC compatibility for now.
Removed ps_locked and replaced with ps_error. Added set_fail_state. Fixed md5_file.
This commit is contained in:
parent
80fdb2cdb2
commit
f336585d4f
@ -38,12 +38,12 @@
|
||||
|
||||
enum
|
||||
{
|
||||
ps_bad_load,
|
||||
ps_error,
|
||||
ps_locked,
|
||||
ps_paused,
|
||||
ps_stopped,
|
||||
ps_running,
|
||||
ps_bad_load, //Load failed
|
||||
ps_error, //Erroneous state
|
||||
ps_locked, //UNUSED
|
||||
ps_paused, //Plugin is temporarily paused
|
||||
ps_stopped, //Plugin is ... more temporarily paused
|
||||
ps_running, //Plugin is running
|
||||
};
|
||||
|
||||
class CPluginMngr
|
||||
|
@ -87,6 +87,7 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
|
||||
m_pParams = temp;
|
||||
}
|
||||
cell *dest = m_pParams;
|
||||
#if defined WIN32 && !defined __GNUC__
|
||||
__asm
|
||||
{
|
||||
push esi;
|
||||
@ -100,7 +101,9 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
|
||||
pop edi;
|
||||
pop ecx;
|
||||
};
|
||||
//memcpy(m_pParams, pParams, sizeof(cell) * iParamsLen);
|
||||
#else
|
||||
memcpy(m_pParams, pParams, sizeof(cell) * iParamsLen);
|
||||
#endif
|
||||
m_pParams[iParamsLen] = 0;
|
||||
} else {
|
||||
m_iParamLen = 0;
|
||||
|
@ -1085,8 +1085,11 @@ static cell AMX_NATIVE_CALL amx_md5_file(AMX *amx, cell *params)
|
||||
int len = 0;
|
||||
char *str = get_amxstring(amx, params[1], 0, len);
|
||||
char buffer[33];
|
||||
char file[255];
|
||||
|
||||
FILE *fp = fopen(str, "rb");
|
||||
build_pathname_r(file, sizeof(file)-1, "%s", str);
|
||||
|
||||
FILE *fp = fopen(file, "rb");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
@ -3593,7 +3596,11 @@ static cell AMX_NATIVE_CALL amx_abort(AMX *amx, cell *params)
|
||||
|
||||
static cell AMX_NATIVE_CALL get_tick_count(AMX *amx, cell *params)
|
||||
{
|
||||
#if defined WIN32
|
||||
return GetTickCount();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL module_exists(AMX *amx, cell *params)
|
||||
@ -3640,6 +3647,20 @@ static cell AMX_NATIVE_CALL module_exists(AMX *amx, cell *params)
|
||||
return (found ? 1 : 0);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_fail_state(AMX *amx, cell *params)
|
||||
{
|
||||
int len;
|
||||
char *str = get_amxstring(amx, params[1], 0, len);
|
||||
|
||||
CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(amx);
|
||||
|
||||
pPlugin->setStatus(ps_error);
|
||||
pPlugin->setError(str);
|
||||
|
||||
//plugin dies once amx_Exec concludes
|
||||
return 0;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO amxmodx_Natives[] =
|
||||
{
|
||||
{"abort", amx_abort},
|
||||
@ -3789,6 +3810,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
|
||||
{"set_cvar_float", set_cvar_float},
|
||||
{"set_cvar_num", set_cvar_num},
|
||||
{"set_cvar_string", set_cvar_string},
|
||||
{"set_fail_state", set_fail_state},
|
||||
{"set_hudmessage", set_hudmessage},
|
||||
{"set_localinfo", set_localinfo},
|
||||
{"set_task", set_task},
|
||||
|
@ -249,14 +249,10 @@ int C_Spawn(edict_t *pent)
|
||||
// ###### Load lang
|
||||
char file[256];
|
||||
g_langMngr.LoadCache(build_pathname_r(file, sizeof(file) - 1, "%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
|
||||
DWORD stop,start=GetTickCount();
|
||||
if (!g_langMngr.Load(build_pathname_r(file, sizeof(file) - 1, "%s/languages.dat", get_localinfo("amxmodx_datadir", "addons/amxmodx/data"))))
|
||||
{
|
||||
LOG_MESSAGE(PLID, "Cache invalidated!");
|
||||
g_langMngr.InvalidateCache();
|
||||
}
|
||||
stop=GetTickCount();
|
||||
LOG_MESSAGE(PLID, "CacheDB load time: %d milliseconds", stop-start);
|
||||
|
||||
// ###### Initialize commands prefixes
|
||||
g_commands.registerPrefix("amx");
|
||||
|
@ -153,7 +153,11 @@ public:
|
||||
return m_Head->prev->obj;
|
||||
}
|
||||
private:
|
||||
typename CStack<ListNode *> m_FreeStack;
|
||||
#if defined __GNUC__
|
||||
CStack<List::ListNode *> m_FreeStack;
|
||||
#else
|
||||
typename CStack<List::ListNode *> m_FreeStack;
|
||||
#endif
|
||||
ListNode *m_Head;
|
||||
size_t m_Size;
|
||||
public:
|
||||
|
@ -58,12 +58,17 @@ void amx_command()
|
||||
|
||||
a = g_plugins.begin();
|
||||
|
||||
int num = 0;
|
||||
while (a)
|
||||
{
|
||||
num++;
|
||||
if ((*a).getStatusCode() == ps_bad_load)
|
||||
{
|
||||
//error
|
||||
print_srvconsole("Load fails: %s\n", (*a).getError());
|
||||
print_srvconsole("(%3d) Load fails: %s\n", num, (*a).getError());
|
||||
} else if ( (*a).getStatusCode() == ps_error) {
|
||||
//error
|
||||
print_srvconsole("(%3d) Error: %s\n", num, (*a).getError());
|
||||
}
|
||||
++a;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user