mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-28 23:06:24 +02:00
Change ClientCommandManager to become non-static
This commit is contained in:
parent
91a52ebb8e
commit
06376ca4ef
@ -239,7 +239,14 @@ int main(int argc, char * argv[])
|
||||
std::cout.flags(std::ios::unitbuf);
|
||||
#ifndef VCMI_IOS
|
||||
console = new CConsoleHandler();
|
||||
*console->cb = ClientCommandManager::processCommand;
|
||||
|
||||
auto callbackFunction = [](std::string buffer, bool calledFromIngameConsole)
|
||||
{
|
||||
ClientCommandManager commandController;
|
||||
commandController.processCommand(buffer, calledFromIngameConsole);
|
||||
};
|
||||
|
||||
*console->cb = callbackFunction;
|
||||
console->start();
|
||||
#endif
|
||||
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include "../lib/ScriptHandler.h"
|
||||
#endif
|
||||
|
||||
bool ClientCommandManager::currentCallFromIngameConsole;
|
||||
|
||||
void ClientCommandManager::handleGoSolo()
|
||||
{
|
||||
Settings session = settings.write["session"];
|
||||
|
@ -17,15 +17,15 @@ class CIntObject;
|
||||
|
||||
class ClientCommandManager //take mantis #2292 issue about account if thinking about handling cheats from command-line
|
||||
{
|
||||
static bool currentCallFromIngameConsole;
|
||||
bool currentCallFromIngameConsole;
|
||||
|
||||
static void giveTurn(const PlayerColor &color);
|
||||
static void printInfoAboutInterfaceObject(const CIntObject *obj, int level);
|
||||
static void printCommandMessage(const std::string &commandMessage, ELogLevel::ELogLevel messageType = ELogLevel::NOT_SET);
|
||||
static void handleGoSolo();
|
||||
static void handleControlAi(const std::string &colorName);
|
||||
void giveTurn(const PlayerColor &color);
|
||||
void printInfoAboutInterfaceObject(const CIntObject *obj, int level);
|
||||
void printCommandMessage(const std::string &commandMessage, ELogLevel::ELogLevel messageType = ELogLevel::NOT_SET);
|
||||
void handleGoSolo();
|
||||
void handleControlAi(const std::string &colorName);
|
||||
|
||||
public:
|
||||
ClientCommandManager() = delete;
|
||||
static void processCommand(const std::string &message, bool calledFromIngameConsole);
|
||||
ClientCommandManager() = default;
|
||||
void processCommand(const std::string &message, bool calledFromIngameConsole);
|
||||
};
|
||||
|
@ -1154,7 +1154,13 @@ void CInGameConsole::endEnteringText(bool processEnteredText)
|
||||
if(txt.at(0) == '/')
|
||||
{
|
||||
//some commands like gosolo don't work when executed from GUI thread
|
||||
boost::thread clientCommandThread(ClientCommandManager::processCommand, txt.substr(1), true);
|
||||
auto threadFunction = [=]()
|
||||
{
|
||||
ClientCommandManager commandController;
|
||||
commandController.processCommand(txt.substr(1), true);
|
||||
};
|
||||
|
||||
boost::thread clientCommandThread(threadFunction);
|
||||
clientCommandThread.detach();
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user