1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-03-21 12:28:56 +01:00

Fixed up bugs and linking errors - loads but crashes.

This commit is contained in:
David Anderson 2008-11-16 03:41:17 -06:00
parent 57509d39bf
commit c1815bbf95
3 changed files with 20 additions and 37 deletions

View File

@ -516,7 +516,7 @@ mm_LoadPluginsFromFile(const char *_file)
fp = fopen(_file, "rt");
if (!fp)
{
LogMessage("[META] Could not open plugins file %s\n", _file);
mm_LogMessage("[META] Could not open plugins file %s\n", _file);
return -1;
}
@ -590,18 +590,14 @@ mm_LoadPluginsFromFile(const char *_file)
id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error));
if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
{
LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
mm_LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
}
else
{
if (already)
{
skipped++;
}
else
{
total++;
}
}
}
else
@ -626,31 +622,23 @@ mm_LoadPluginsFromFile(const char *_file)
id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error));
if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
{
LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
mm_LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
}
else
{
if (already)
{
skipped++;
}
else
{
total++;
}
}
}
}
fclose(fp);
if (skipped)
{
LogMessage("[META] Loaded %d plugins from file (%d already loaded)", total, skipped);
}
mm_LogMessage("[META] Loaded %d plugins from file (%d already loaded)", total, skipped);
else
{
LogMessage("[META] Loaded %d plugins from file.", total);
}
mm_LogMessage("[META] Loaded %d plugins from file.", total);
return total;
}
@ -958,7 +946,7 @@ void MetamodSource::LogMsg(ISmmPlugin *pl, const char *msg, ...)
UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
va_end(ap);
LogMessage("[%s] %s", pl->GetLogTag(), buffer);
mm_LogMessage("[%s] %s", pl->GetLogTag(), buffer);
}
CreateInterfaceFn MetamodSource::GetEngineFactory(bool syn/* =true */)
@ -1434,20 +1422,14 @@ ProcessVDF(const char *path)
char alias[24], file[255], error[255];
if (!provider->ProcessVDF(path, file, sizeof(file), alias, sizeof(alias)))
{
return;
}
if (alias[0] != '\0')
{
g_PluginMngr.SetAlias(alias, file);
}
id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error));
if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
{
LogMessage("[META] Failed to load plugin %s: %s", file, error);
}
mm_LogMessage("[META] Failed to load plugin %s: %s", file, error);
}
static void
@ -1472,7 +1454,7 @@ LookForVDFs(const char *dir)
error,
sizeof(error),
NULL);
LogMessage("[META] Could not open folder \"%s\" (%s)", dir, error);
mm_LogMessage("[META] Could not open folder \"%s\" (%s)", dir, error);
return;
}
@ -1499,7 +1481,7 @@ LookForVDFs(const char *dir)
if ((pDir = opendir(dir)) == NULL)
{
LogMessage("[META] Could not open folder \"%s\" (%s)", dir, strerror(errno));
mm_LogMessage("[META] Could not open folder \"%s\" (%s)", dir, strerror(errno));
return;
}

View File

@ -95,6 +95,5 @@ bool UTIL_Relatize(char buffer[],
const char *relTo,
const char *relFrom);
void LogMessage(const char *msg, ...);
#endif //_INCLUDE_UTIL_H

View File

@ -41,6 +41,7 @@
#include "metamod_console.h"
#include "vsp_listener.h"
#include <filesystem.h>
#include "metamod.h"
/* Types */
typedef void (*CONPRINTF_FUNC)(const char *, ...);
@ -64,17 +65,18 @@ void ClientCommand(edict_t *pEdict, const CCommand &args);
void LocalCommand_Meta(const CCommand &args);
void _ServerCommand();
/* Variables */
bool usermsgs_extracted = false;
CVector<UsrMsgInfo> usermsgs_list;
static bool usermsgs_extracted = false;
static CVector<UsrMsgInfo> usermsgs_list;
static VSPListener g_VspListener;
static BaseProvider g_Ep1Provider;
static List<ConCommandBase *> conbases_unreg;
ICvar *icvar = NULL;
ISmmAPI *metamod_api = NULL;
IFileSystem *baseFs = NULL;
IServerGameDLL *server = NULL;
IVEngineServer *engine = NULL;
IServerGameClients *gameclients = NULL;
VSPListener g_VspListener;
BaseProvider g_Ep1Provider;
IMetamodSourceProvider *provider = &g_Ep1Provider;
List<ConCommandBase *> conbases_unreg;
IFileSystem *baseFs = NULL;
ConCommand meta_local_cmd("meta", LocalCommand_Meta, "Metamod:Source control options");
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
@ -126,7 +128,7 @@ void BaseProvider::Notify_DLLInit_Pre(CreateInterfaceFn engineFactory,
baseFs = (IFileSystem *)((engineFactory)(FILESYSTEM_INTERFACE_VERSION, NULL));
if (baseFs == NULL)
{
::LogMessage("Unable to find \"%s\": .vdf files will not be parsed", FILESYSTEM_INTERFACE_VERSION);
mm_LogMessage("Unable to find \"%s\": .vdf files will not be parsed", FILESYSTEM_INTERFACE_VERSION);
return;
}