1.1 --- a/core/interfaces/IPluginSys.h Sun Dec 17 09:56:45 2006 +0000
1.2 +++ b/core/interfaces/IPluginSys.h Sun Dec 17 09:59:01 2006 +0000
1.3 @@ -28,6 +28,8 @@
1.4
1.5 /**
1.6 * @brief Describes the usability status of a plugin.
1.7 + * Note: The status "Loaded" and "Created" are only reachable
1.8 + * during map load.
1.9 */
1.10 enum PluginStatus
1.11 {
2.1 --- a/core/sm_srvcmds.cpp Sun Dec 17 09:56:45 2006 +0000
2.2 +++ b/core/sm_srvcmds.cpp Sun Dec 17 09:59:01 2006 +0000
2.3 @@ -29,11 +29,11 @@
2.4 case Plugin_BadLoad:
2.5 return "Bad Load";
2.6 default:
2.7 + assert(false);
2.8 return "-";
2.9 }
2.10 }
2.11
2.12 -#define IS_STR_FILLED(var) (var[0] != '\0')
2.13 CON_COMMAND(sm, "SourceMod Menu")
2.14 {
2.15 int argnum = engine->Cmd_Argc();
2.16 @@ -69,12 +69,12 @@
2.17 const sm_plugininfo_t *info = pl->GetPublicInfo();
2.18
2.19 len += snprintf(&buffer[len], sizeof(buffer)-len, " %02d <%s>", id, StatusToStr(pl->GetStatus()));
2.20 - len += snprintf(&buffer[len], sizeof(buffer)-len, " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
2.21 - if (IS_STR_FILLED(info->version))
2.22 + len += snprintf(&buffer[len], sizeof(buffer)-len, " \"%s\"", (info->name) ? info->name : iter->GetPlugin()->GetFilename());
2.23 + if (info->version)
2.24 {
2.25 len += snprintf(&buffer[len], sizeof(buffer)-len, " (%s)", info->version);
2.26 }
2.27 - if (IS_STR_FILLED(info->author))
2.28 + if (info->author)
2.29 {
2.30 snprintf(&buffer[len], sizeof(buffer)-len, " by %s", info->author);
2.31 }
2.32 @@ -102,6 +102,7 @@
2.33 }
2.34
2.35 return;
2.36 +
2.37 } else if (!strcmp("unload", cmd2)) {
2.38 if (argnum < 4)
2.39 {
2.40 @@ -109,6 +110,7 @@
2.41 return;
2.42 }
2.43
2.44 + IPlugin *pl = NULL;
2.45 int id = 1;
2.46 int num = atoi(engine->Cmd_Argv(3));
2.47 if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
2.48 @@ -119,11 +121,11 @@
2.49
2.50 IPluginIterator *iter = g_PluginSys.GetPluginIterator();
2.51 for (; iter->MorePlugins() && id<num; iter->NextPlugin(), id++) {}
2.52 - IPlugin *pl = iter->GetPlugin();
2.53 + pl = iter->GetPlugin();
2.54
2.55 char name[64];
2.56 const sm_plugininfo_t *info = pl->GetPublicInfo();
2.57 - strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
2.58 + strcpy(name, (info->name) ? info->name : pl->GetFilename());
2.59
2.60 if (g_PluginSys.UnloadPlugin(pl))
2.61 {
2.62 @@ -134,6 +136,7 @@
2.63
2.64 iter->Release();
2.65 return;
2.66 +
2.67 } else if (!strcmp("info", cmd2)) {
2.68 if (argnum < 4)
2.69 {
2.70 @@ -141,6 +144,7 @@
2.71 return;
2.72 }
2.73
2.74 + IPlugin *pl = NULL;
2.75 int id = 1;
2.76 int num = atoi(engine->Cmd_Argv(3));
2.77 if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
2.78 @@ -151,28 +155,27 @@
2.79
2.80 IPluginIterator *iter = g_PluginSys.GetPluginIterator();
2.81 for (; iter->MorePlugins() && id<num; iter->NextPlugin(), id++) {}
2.82 -
2.83 - IPlugin *pl = iter->GetPlugin();
2.84 + pl = iter->GetPlugin();
2.85 const sm_plugininfo_t *info = pl->GetPublicInfo();
2.86
2.87 META_CONPRINTF(" Filename: %s\n", pl->GetFilename());
2.88 - if (IS_STR_FILLED(info->name))
2.89 + if (info->name)
2.90 {
2.91 META_CONPRINTF(" Title: %s\n", info->name);
2.92 }
2.93 - if (IS_STR_FILLED(info->author))
2.94 + if (info->author)
2.95 {
2.96 META_CONPRINTF(" Author: %s\n", info->author);
2.97 }
2.98 - if (IS_STR_FILLED(info->version))
2.99 + if (info->version)
2.100 {
2.101 META_CONPRINTF(" Version: %s\n", info->version);
2.102 }
2.103 - if (IS_STR_FILLED(info->description))
2.104 + if (info->description)
2.105 {
2.106 META_CONPRINTF(" Description: %s\n", info->description);
2.107 }
2.108 - if (IS_STR_FILLED(info->url))
2.109 + if (info->url)
2.110 {
2.111 META_CONPRINTF(" URL: %s\n", info->url);
2.112 }
3.1 --- a/core/sm_srvcmds.h Sun Dec 17 09:56:45 2006 +0000
3.2 +++ b/core/sm_srvcmds.h Sun Dec 17 09:59:01 2006 +0000
3.3 @@ -1,7 +1,10 @@
3.4 +#ifndef _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
3.5 +#define _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
3.6 +
3.7 +#include "sourcemod.h"
3.8 +#include "PluginSys.h"
3.9 #include "sourcemm_api.h"
3.10 #include <convar.h>
3.11 -#include "sourcemod.h"
3.12 -#include "PluginSys.h"
3.13
3.14 using namespace SourceMod;
3.15
3.16 @@ -13,4 +16,6 @@
3.17 virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
3.18 public: // SMGlobalClass
3.19 virtual void OnSourceModStartup(bool late);
3.20 -};
3.21 \ No newline at end of file
3.22 +};
3.23 +
3.24 +#endif //_INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_