Clarified states a little
Fixed include order and double include prevention --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40228
This commit is contained in:
parent
352b15c1b7
commit
7af40128a3
@ -28,6 +28,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Describes the usability status of a plugin.
|
* @brief Describes the usability status of a plugin.
|
||||||
|
* Note: The status "Loaded" and "Created" are only reachable
|
||||||
|
* during map load.
|
||||||
*/
|
*/
|
||||||
enum PluginStatus
|
enum PluginStatus
|
||||||
{
|
{
|
||||||
|
@ -29,11 +29,11 @@ inline const char *StatusToStr(PluginStatus st)
|
|||||||
case Plugin_BadLoad:
|
case Plugin_BadLoad:
|
||||||
return "Bad Load";
|
return "Bad Load";
|
||||||
default:
|
default:
|
||||||
|
assert(false);
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IS_STR_FILLED(var) (var[0] != '\0')
|
|
||||||
CON_COMMAND(sm, "SourceMod Menu")
|
CON_COMMAND(sm, "SourceMod Menu")
|
||||||
{
|
{
|
||||||
int argnum = engine->Cmd_Argc();
|
int argnum = engine->Cmd_Argc();
|
||||||
@ -69,12 +69,12 @@ CON_COMMAND(sm, "SourceMod Menu")
|
|||||||
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||||
|
|
||||||
len += snprintf(&buffer[len], sizeof(buffer)-len, " %02d <%s>", id, StatusToStr(pl->GetStatus()));
|
len += snprintf(&buffer[len], sizeof(buffer)-len, " %02d <%s>", id, StatusToStr(pl->GetStatus()));
|
||||||
len += snprintf(&buffer[len], sizeof(buffer)-len, " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
len += snprintf(&buffer[len], sizeof(buffer)-len, " \"%s\"", (info->name) ? info->name : iter->GetPlugin()->GetFilename());
|
||||||
if (IS_STR_FILLED(info->version))
|
if (info->version)
|
||||||
{
|
{
|
||||||
len += snprintf(&buffer[len], sizeof(buffer)-len, " (%s)", info->version);
|
len += snprintf(&buffer[len], sizeof(buffer)-len, " (%s)", info->version);
|
||||||
}
|
}
|
||||||
if (IS_STR_FILLED(info->author))
|
if (info->author)
|
||||||
{
|
{
|
||||||
snprintf(&buffer[len], sizeof(buffer)-len, " by %s", info->author);
|
snprintf(&buffer[len], sizeof(buffer)-len, " by %s", info->author);
|
||||||
}
|
}
|
||||||
@ -102,6 +102,7 @@ CON_COMMAND(sm, "SourceMod Menu")
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (!strcmp("unload", cmd2)) {
|
} else if (!strcmp("unload", cmd2)) {
|
||||||
if (argnum < 4)
|
if (argnum < 4)
|
||||||
{
|
{
|
||||||
@ -109,6 +110,7 @@ CON_COMMAND(sm, "SourceMod Menu")
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPlugin *pl = NULL;
|
||||||
int id = 1;
|
int id = 1;
|
||||||
int num = atoi(engine->Cmd_Argv(3));
|
int num = atoi(engine->Cmd_Argv(3));
|
||||||
if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
|
if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
|
||||||
@ -119,11 +121,11 @@ CON_COMMAND(sm, "SourceMod Menu")
|
|||||||
|
|
||||||
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
|
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
|
||||||
for (; iter->MorePlugins() && id<num; iter->NextPlugin(), id++) {}
|
for (; iter->MorePlugins() && id<num; iter->NextPlugin(), id++) {}
|
||||||
IPlugin *pl = iter->GetPlugin();
|
pl = iter->GetPlugin();
|
||||||
|
|
||||||
char name[64];
|
char name[64];
|
||||||
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||||
strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
strcpy(name, (info->name) ? info->name : pl->GetFilename());
|
||||||
|
|
||||||
if (g_PluginSys.UnloadPlugin(pl))
|
if (g_PluginSys.UnloadPlugin(pl))
|
||||||
{
|
{
|
||||||
@ -134,6 +136,7 @@ CON_COMMAND(sm, "SourceMod Menu")
|
|||||||
|
|
||||||
iter->Release();
|
iter->Release();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (!strcmp("info", cmd2)) {
|
} else if (!strcmp("info", cmd2)) {
|
||||||
if (argnum < 4)
|
if (argnum < 4)
|
||||||
{
|
{
|
||||||
@ -141,6 +144,7 @@ CON_COMMAND(sm, "SourceMod Menu")
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPlugin *pl = NULL;
|
||||||
int id = 1;
|
int id = 1;
|
||||||
int num = atoi(engine->Cmd_Argv(3));
|
int num = atoi(engine->Cmd_Argv(3));
|
||||||
if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
|
if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
|
||||||
@ -151,28 +155,27 @@ CON_COMMAND(sm, "SourceMod Menu")
|
|||||||
|
|
||||||
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
|
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
|
||||||
for (; iter->MorePlugins() && id<num; iter->NextPlugin(), id++) {}
|
for (; iter->MorePlugins() && id<num; iter->NextPlugin(), id++) {}
|
||||||
|
pl = iter->GetPlugin();
|
||||||
IPlugin *pl = iter->GetPlugin();
|
|
||||||
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||||
|
|
||||||
META_CONPRINTF(" Filename: %s\n", pl->GetFilename());
|
META_CONPRINTF(" Filename: %s\n", pl->GetFilename());
|
||||||
if (IS_STR_FILLED(info->name))
|
if (info->name)
|
||||||
{
|
{
|
||||||
META_CONPRINTF(" Title: %s\n", info->name);
|
META_CONPRINTF(" Title: %s\n", info->name);
|
||||||
}
|
}
|
||||||
if (IS_STR_FILLED(info->author))
|
if (info->author)
|
||||||
{
|
{
|
||||||
META_CONPRINTF(" Author: %s\n", info->author);
|
META_CONPRINTF(" Author: %s\n", info->author);
|
||||||
}
|
}
|
||||||
if (IS_STR_FILLED(info->version))
|
if (info->version)
|
||||||
{
|
{
|
||||||
META_CONPRINTF(" Version: %s\n", info->version);
|
META_CONPRINTF(" Version: %s\n", info->version);
|
||||||
}
|
}
|
||||||
if (IS_STR_FILLED(info->description))
|
if (info->description)
|
||||||
{
|
{
|
||||||
META_CONPRINTF(" Description: %s\n", info->description);
|
META_CONPRINTF(" Description: %s\n", info->description);
|
||||||
}
|
}
|
||||||
if (IS_STR_FILLED(info->url))
|
if (info->url)
|
||||||
{
|
{
|
||||||
META_CONPRINTF(" URL: %s\n", info->url);
|
META_CONPRINTF(" URL: %s\n", info->url);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
#include "sourcemm_api.h"
|
#ifndef _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
|
||||||
#include <convar.h>
|
#define _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
|
||||||
|
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include "PluginSys.h"
|
#include "PluginSys.h"
|
||||||
|
#include "sourcemm_api.h"
|
||||||
|
#include <convar.h>
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
|
|
||||||
@ -13,4 +16,6 @@ public: // IConCommandBaseAccessor
|
|||||||
virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
|
virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
|
||||||
public: // SMGlobalClass
|
public: // SMGlobalClass
|
||||||
virtual void OnSourceModStartup(bool late);
|
virtual void OnSourceModStartup(bool late);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user