forked from cafeberry/cafeberry
feat: add smartcmd dedicated server
major bug: when connecting to the server a second time, it gets softlocked and keeps repeating ticking connection A\n in debug logs until it times out.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "CliCommandHelp.h"
|
||||
|
||||
#include "../../ServerCliEngine.h"
|
||||
#include "../../ServerCliRegistry.h"
|
||||
#include "../../ServerCliParser.h"
|
||||
|
||||
namespace ServerRuntime
|
||||
{
|
||||
const char *CliCommandHelp::Name() const
|
||||
{
|
||||
return "help";
|
||||
}
|
||||
|
||||
std::vector<std::string> CliCommandHelp::Aliases() const
|
||||
{
|
||||
std::vector<std::string> aliases;
|
||||
aliases.push_back("?");
|
||||
return aliases;
|
||||
}
|
||||
|
||||
const char *CliCommandHelp::Usage() const
|
||||
{
|
||||
return "help";
|
||||
}
|
||||
|
||||
const char *CliCommandHelp::Description() const
|
||||
{
|
||||
return "Show available server console commands.";
|
||||
}
|
||||
|
||||
bool CliCommandHelp::Execute(const ServerCliParsedLine &line, ServerCliEngine *engine)
|
||||
{
|
||||
(void)line;
|
||||
const std::vector<std::unique_ptr<IServerCliCommand>> &commands = engine->Registry().Commands();
|
||||
engine->LogInfo("Available commands:");
|
||||
for (size_t i = 0; i < commands.size(); ++i)
|
||||
{
|
||||
std::string row = " ";
|
||||
row += commands[i]->Usage();
|
||||
row += " - ";
|
||||
row += commands[i]->Description();
|
||||
engine->LogInfo(row);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "../IServerCliCommand.h"
|
||||
|
||||
namespace ServerRuntime
|
||||
{
|
||||
class CliCommandHelp : public IServerCliCommand
|
||||
{
|
||||
public:
|
||||
virtual const char *Name() const;
|
||||
virtual std::vector<std::string> Aliases() const;
|
||||
virtual const char *Usage() const;
|
||||
virtual const char *Description() const;
|
||||
virtual bool Execute(const ServerCliParsedLine &line, ServerCliEngine *engine);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user