1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Allow ingame console to use clientside commands and print output

This commit is contained in:
Dydzio
2023-01-06 21:01:00 +01:00
parent b1c008179d
commit 622e012fcf
6 changed files with 95 additions and 51 deletions

View File

@@ -230,7 +230,7 @@ int CConsoleHandler::run()
{
if ( getline(std::cin, buffer).good() )
if ( cb && *cb )
(*cb)(buffer);
(*cb)(buffer, false);
}
else
boost::this_thread::sleep(boost::posix_time::millisec(100));
@@ -239,7 +239,7 @@ int CConsoleHandler::run()
#else
std::getline(std::cin, buffer);
if ( cb && *cb )
(*cb)(buffer);
(*cb)(buffer, false);
#endif
}
return -1;
@@ -263,7 +263,7 @@ CConsoleHandler::CConsoleHandler() : thread(nullptr)
#else
defColor = "\x1b[0m";
#endif
cb = new std::function<void(const std::string &)>;
cb = new std::function<void(const std::string &, bool)>;
}
CConsoleHandler::~CConsoleHandler()
{