1.1 --- a/core/sm_srvcmds.cpp Sat Dec 16 22:31:32 2006 +0000
1.2 +++ b/core/sm_srvcmds.cpp Sun Dec 17 02:51:35 2006 +0000
1.3 @@ -33,6 +33,7 @@
1.4 }
1.5 }
1.6
1.7 +#define IS_STR_FILLED(var) (var[0] != '\0')
1.8 CON_COMMAND(sm, "SourceMod Menu")
1.9 {
1.10 int argnum = engine->Cmd_Argc();
1.11 @@ -68,12 +69,12 @@
1.12 const sm_plugininfo_t *info = pl->GetPublicInfo();
1.13
1.14 len += snprintf(&buffer[len], sizeof(buffer)-len, " %02d <%s>", id, StatusToStr(pl->GetStatus()));
1.15 - len += snprintf(&buffer[len], sizeof(buffer)-len, " \"%s\"", (info->name) ? info->name : iter->GetPlugin()->GetFilename());
1.16 - if (info->version)
1.17 + len += snprintf(&buffer[len], sizeof(buffer)-len, " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
1.18 + if (IS_STR_FILLED(info->version))
1.19 {
1.20 len += snprintf(&buffer[len], sizeof(buffer)-len, " (%s)", info->version);
1.21 }
1.22 - if (info->author)
1.23 + if (IS_STR_FILLED(info->author))
1.24 {
1.25 snprintf(&buffer[len], sizeof(buffer)-len, " by %s", info->author);
1.26 }
1.27 @@ -101,7 +102,6 @@
1.28 }
1.29
1.30 return;
1.31 -
1.32 } else if (!strcmp("unload", cmd2)) {
1.33 if (argnum < 4)
1.34 {
1.35 @@ -109,7 +109,6 @@
1.36 return;
1.37 }
1.38
1.39 - IPlugin *pl = NULL;
1.40 int id = 1;
1.41 int num = atoi(engine->Cmd_Argv(3));
1.42 if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
1.43 @@ -120,11 +119,11 @@
1.44
1.45 IPluginIterator *iter = g_PluginSys.GetPluginIterator();
1.46 for (; iter->MorePlugins() && id<num; iter->NextPlugin(), id++) {}
1.47 - pl = iter->GetPlugin();
1.48 + IPlugin *pl = iter->GetPlugin();
1.49
1.50 char name[64];
1.51 const sm_plugininfo_t *info = pl->GetPublicInfo();
1.52 - strcpy(name, (info->name) ? info->name : pl->GetFilename());
1.53 + strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
1.54
1.55 if (g_PluginSys.UnloadPlugin(pl))
1.56 {
1.57 @@ -135,7 +134,6 @@
1.58
1.59 iter->Release();
1.60 return;
1.61 -
1.62 } else if (!strcmp("info", cmd2)) {
1.63 if (argnum < 4)
1.64 {
1.65 @@ -143,7 +141,6 @@
1.66 return;
1.67 }
1.68
1.69 - IPlugin *pl = NULL;
1.70 int id = 1;
1.71 int num = atoi(engine->Cmd_Argv(3));
1.72 if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
1.73 @@ -154,27 +151,28 @@
1.74
1.75 IPluginIterator *iter = g_PluginSys.GetPluginIterator();
1.76 for (; iter->MorePlugins() && id<num; iter->NextPlugin(), id++) {}
1.77 - pl = iter->GetPlugin();
1.78 +
1.79 + IPlugin *pl = iter->GetPlugin();
1.80 const sm_plugininfo_t *info = pl->GetPublicInfo();
1.81
1.82 META_CONPRINTF(" Filename: %s\n", pl->GetFilename());
1.83 - if (info->name)
1.84 + if (IS_STR_FILLED(info->name))
1.85 {
1.86 META_CONPRINTF(" Title: %s\n", info->name);
1.87 }
1.88 - if (info->author)
1.89 + if (IS_STR_FILLED(info->author))
1.90 {
1.91 META_CONPRINTF(" Author: %s\n", info->author);
1.92 }
1.93 - if (info->version)
1.94 + if (IS_STR_FILLED(info->version))
1.95 {
1.96 META_CONPRINTF(" Version: %s\n", info->version);
1.97 }
1.98 - if (info->description)
1.99 + if (IS_STR_FILLED(info->description))
1.100 {
1.101 META_CONPRINTF(" Description: %s\n", info->description);
1.102 }
1.103 - if (info->url)
1.104 + if (IS_STR_FILLED(info->url))
1.105 {
1.106 META_CONPRINTF(" URL: %s\n", info->url);
1.107 }