added console cmd list

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40275
This commit is contained in:
Borja Ferrer 2007-01-05 13:23:25 +00:00
parent c4d8d30a39
commit ac50163647
3 changed files with 22 additions and 11 deletions

View File

@ -39,11 +39,6 @@ void CLogger::_NewMapFile()
char date[32]; char date[32];
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime); strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: SourceMod log file started (file \"L%02d%02d%03d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, i, SOURCEMOD_VERSION); fprintf(fp, "L %s: SourceMod log file started (file \"L%02d%02d%03d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, i, SOURCEMOD_VERSION);
if (m_PrntMapname)
{
fprintf(fp, "L %s: Info (map \"%s\")\n", date, m_CurMapName.c_str());
m_PrntMapname = false;
}
fclose(fp); fclose(fp);
} }
} }
@ -182,7 +177,7 @@ void CLogger::LogMessage(const char *vafmt, ...)
if (m_DailyPrintHdr) if (m_DailyPrintHdr)
{ {
m_DailyPrintHdr = false; m_DailyPrintHdr = false;
fprintf(fp, "L %s: SourceMod log file started (file \"L%02d%02d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, SOURCEMOD_VERSION); fprintf(fp, "L %s: SourceMod log file session started (file \"L%02d%02d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, SOURCEMOD_VERSION);
} }
fprintf(fp, "L %s: %s\n", date, msg); fprintf(fp, "L %s: %s\n", date, msg);
fclose(fp); fclose(fp);
@ -191,6 +186,7 @@ void CLogger::LogMessage(const char *vafmt, ...)
} }
g_SMAPI->ConPrintf("L %s: %s\n", date, msg); g_SMAPI->ConPrintf("L %s: %s\n", date, msg);
return;
print_error: print_error:
g_SMAPI->ConPrint("[SM] Unexpected fatal logging error. SourceMod logging disabled.\n"); g_SMAPI->ConPrint("[SM] Unexpected fatal logging error. SourceMod logging disabled.\n");
m_Active = false; m_Active = false;
@ -253,7 +249,6 @@ void CLogger::LogMessageEx(LogType type, const char *vafmt, ...)
void CLogger::MapChange(const char *mapname) void CLogger::MapChange(const char *mapname)
{ {
m_CurMapName.assign(mapname); m_CurMapName.assign(mapname);
m_PrntMapname = true;
switch (m_mode) switch (m_mode)
{ {

View File

@ -25,7 +25,7 @@ enum LoggingMode
class CLogger class CLogger
{ {
public: public:
CLogger() : m_PrntMapname(false), m_ErrMapStart(false), m_Active(false), m_DelayedStart(false), m_DailyPrintHdr(false) {} CLogger() : m_ErrMapStart(false), m_Active(false), m_DelayedStart(false), m_DailyPrintHdr(false) {}
public: public:
void InitLogger(LoggingMode mode, bool startlogging); void InitLogger(LoggingMode mode, bool startlogging);
void CloseLogger(); void CloseLogger();
@ -46,7 +46,6 @@ private:
String m_CurMapName; String m_CurMapName;
LoggingMode m_mode; LoggingMode m_mode;
int m_CurDay; int m_CurDay;
bool m_PrntMapname;
bool m_ErrMapStart; bool m_ErrMapStart;
bool m_Active; bool m_Active;
bool m_DelayedStart; bool m_DelayedStart;

View File

@ -1,4 +1,5 @@
#include "sm_srvcmds.h" #include "sm_srvcmds.h"
#include "sm_version.h"
ConVarAccessor g_ConCmdAccessor; ConVarAccessor g_ConCmdAccessor;
@ -183,8 +184,24 @@ CON_COMMAND(sm, "SourceMod Menu")
return; return;
} }
} }
//:TODO: print plugins cmd list
META_CONPRINT(" SourceMod Plugin Menu:\n");
META_CONPRINT(" list - Show loaded plugins\n");
META_CONPRINT(" load - Load a plugin\n");
META_CONPRINT(" unload - Unload a plugin\n");
META_CONPRINT(" info - Information about a plugin\n");
return;
} else if (!strcmp("version", cmd)) {
META_CONPRINT(" SourceMod Version Information:\n");
META_CONPRINTF(" SourceMod Version: \"%s\"\n", SOURCEMOD_VERSION);
META_CONPRINTF(" JIT Version: %s (%s)\n", g_pVM->GetVMName(), g_pVM->GetVersionString());
META_CONPRINTF(" JIT Settings: %s\n", g_pVM->GetCPUOptimizations());
META_CONPRINTF(" http://www.sourcemod.net/\n");
return;
} }
} }
//:TODO: print cmd list or something META_CONPRINT(" SourceMod Menu:\n");
META_CONPRINT(" Usage: sm <command> [arguments]\n");
META_CONPRINT(" plugins - Plugins menu\n");
META_CONPRINT(" version - Display version information\n");
} }