Fixed up bugs and linking errors - loads but crashes.
authorDavid Anderson <dvander@alliedmods.net>
Sun Nov 16 03:41:17 2008 -0600 (2008-11-16)
changeset 5538fc4ad22c73d
parent 552 4b73ffd6e176
child 554 40c8522a2a75
Fixed up bugs and linking errors - loads but crashes.
core/metamod.cpp
core/metamod_util.h
core/provider/provider_ep2.cpp
     1.1 --- a/core/metamod.cpp	Sat Nov 15 23:46:27 2008 -0600
     1.2 +++ b/core/metamod.cpp	Sun Nov 16 03:41:17 2008 -0600
     1.3 @@ -516,7 +516,7 @@
     1.4  	fp = fopen(_file, "rt");
     1.5  	if (!fp)
     1.6  	{
     1.7 -		LogMessage("[META] Could not open plugins file %s\n", _file);
     1.8 +		mm_LogMessage("[META] Could not open plugins file %s\n", _file);
     1.9  		return -1;
    1.10  	}
    1.11  
    1.12 @@ -590,18 +590,14 @@
    1.13  			id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error));
    1.14  			if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
    1.15  			{
    1.16 -				LogMessage("[META] Failed to load plugin %s.  %s", buffer, error);
    1.17 +				mm_LogMessage("[META] Failed to load plugin %s.  %s", buffer, error);
    1.18  			}
    1.19  			else
    1.20  			{
    1.21  				if (already)
    1.22 -				{
    1.23  					skipped++;
    1.24 -				}
    1.25  				else
    1.26 -				{
    1.27  					total++;
    1.28 -				}
    1.29  			}
    1.30  		}
    1.31  		else
    1.32 @@ -626,31 +622,23 @@
    1.33  			id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error));
    1.34  			if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
    1.35  			{
    1.36 -				LogMessage("[META] Failed to load plugin %s.  %s", buffer, error);
    1.37 +				mm_LogMessage("[META] Failed to load plugin %s.  %s", buffer, error);
    1.38  			}
    1.39  			else
    1.40  			{
    1.41  				if (already)
    1.42 -				{
    1.43  					skipped++;
    1.44 -				}
    1.45  				else
    1.46 -				{
    1.47  					total++;
    1.48 -				}
    1.49  			}
    1.50  		}
    1.51  	}
    1.52  	fclose(fp);
    1.53  
    1.54  	if (skipped)
    1.55 -	{
    1.56 -		LogMessage("[META] Loaded %d plugins from file (%d already loaded)", total, skipped);
    1.57 -	}
    1.58 +		mm_LogMessage("[META] Loaded %d plugins from file (%d already loaded)", total, skipped);
    1.59  	else
    1.60 -	{
    1.61 -		LogMessage("[META] Loaded %d plugins from file.", total);
    1.62 -	}
    1.63 +		mm_LogMessage("[META] Loaded %d plugins from file.", total);
    1.64  	
    1.65  	return total;
    1.66  }
    1.67 @@ -958,7 +946,7 @@
    1.68  	UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
    1.69  	va_end(ap);
    1.70  
    1.71 -	LogMessage("[%s] %s", pl->GetLogTag(), buffer);
    1.72 +	mm_LogMessage("[%s] %s", pl->GetLogTag(), buffer);
    1.73  }
    1.74  
    1.75  CreateInterfaceFn MetamodSource::GetEngineFactory(bool syn/* =true */)
    1.76 @@ -1434,20 +1422,14 @@
    1.77  	char alias[24], file[255], error[255];
    1.78  
    1.79  	if (!provider->ProcessVDF(path, file, sizeof(file), alias, sizeof(alias)))
    1.80 -	{
    1.81  		return;
    1.82 -	}
    1.83  
    1.84  	if (alias[0] != '\0')
    1.85 -	{
    1.86  		g_PluginMngr.SetAlias(alias, file);
    1.87 -	}
    1.88  
    1.89  	id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error));
    1.90  	if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
    1.91 -	{
    1.92 -		LogMessage("[META] Failed to load plugin %s: %s", file, error);
    1.93 -	}
    1.94 +		mm_LogMessage("[META] Failed to load plugin %s: %s", file, error);
    1.95  }
    1.96  
    1.97  static void
    1.98 @@ -1472,7 +1454,7 @@
    1.99  			error,
   1.100  			sizeof(error),
   1.101  			NULL);
   1.102 -		LogMessage("[META] Could not open folder \"%s\" (%s)", dir, error);
   1.103 +		mm_LogMessage("[META] Could not open folder \"%s\" (%s)", dir, error);
   1.104  		return;
   1.105  	}
   1.106  
   1.107 @@ -1499,7 +1481,7 @@
   1.108  
   1.109  	if ((pDir = opendir(dir)) == NULL)
   1.110  	{
   1.111 -		LogMessage("[META] Could not open folder \"%s\" (%s)", dir, strerror(errno));
   1.112 +		mm_LogMessage("[META] Could not open folder \"%s\" (%s)", dir, strerror(errno));
   1.113  		return;
   1.114  	}
   1.115  
     2.1 --- a/core/metamod_util.h	Sat Nov 15 23:46:27 2008 -0600
     2.2 +++ b/core/metamod_util.h	Sun Nov 16 03:41:17 2008 -0600
     2.3 @@ -95,6 +95,5 @@
     2.4  				   const char *relTo,
     2.5  				   const char *relFrom);
     2.6  
     2.7 -void LogMessage(const char *msg, ...);
     2.8 +#endif //_INCLUDE_UTIL_H
     2.9  
    2.10 -#endif //_INCLUDE_UTIL_H
     3.1 --- a/core/provider/provider_ep2.cpp	Sat Nov 15 23:46:27 2008 -0600
     3.2 +++ b/core/provider/provider_ep2.cpp	Sun Nov 16 03:41:17 2008 -0600
     3.3 @@ -41,6 +41,7 @@
     3.4  #include "metamod_console.h"
     3.5  #include "vsp_listener.h"
     3.6  #include <filesystem.h>
     3.7 +#include "metamod.h"
     3.8  
     3.9  /* Types */
    3.10  typedef void (*CONPRINTF_FUNC)(const char *, ...);
    3.11 @@ -64,17 +65,18 @@
    3.12  void LocalCommand_Meta(const CCommand &args);
    3.13  void _ServerCommand();
    3.14  /* Variables */
    3.15 -bool usermsgs_extracted = false;
    3.16 -CVector<UsrMsgInfo> usermsgs_list;
    3.17 +static bool usermsgs_extracted = false;
    3.18 +static CVector<UsrMsgInfo> usermsgs_list;
    3.19 +static VSPListener g_VspListener;
    3.20 +static BaseProvider g_Ep1Provider;
    3.21 +static List<ConCommandBase *> conbases_unreg;
    3.22 +
    3.23  ICvar *icvar = NULL;
    3.24 -ISmmAPI *metamod_api = NULL;
    3.25 +IFileSystem *baseFs = NULL;
    3.26 +IServerGameDLL *server = NULL;
    3.27  IVEngineServer *engine = NULL;
    3.28  IServerGameClients *gameclients = NULL;
    3.29 -VSPListener g_VspListener;
    3.30 -BaseProvider g_Ep1Provider;
    3.31  IMetamodSourceProvider *provider = &g_Ep1Provider;
    3.32 -List<ConCommandBase *> conbases_unreg;
    3.33 -IFileSystem *baseFs = NULL;
    3.34  ConCommand meta_local_cmd("meta", LocalCommand_Meta, "Metamod:Source control options");
    3.35  
    3.36  SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
    3.37 @@ -126,7 +128,7 @@
    3.38  	baseFs = (IFileSystem *)((engineFactory)(FILESYSTEM_INTERFACE_VERSION, NULL));
    3.39  	if (baseFs == NULL)
    3.40  	{
    3.41 -		::LogMessage("Unable to find \"%s\": .vdf files will not be parsed", FILESYSTEM_INTERFACE_VERSION);
    3.42 +		mm_LogMessage("Unable to find \"%s\": .vdf files will not be parsed", FILESYSTEM_INTERFACE_VERSION);
    3.43  		return;
    3.44  	}
    3.45