1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-07 00:58:39 +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

@ -48,6 +48,7 @@
#include "../../lib/mapping/CMap.h"
#include "../../lib/NetPacksBase.h"
#include "../../lib/StringConstants.h"
#include "ClientCommandManager.h"
CList::CListItem::CListItem(CList * Parent)
: CIntObject(LCLICK | RCLICK | HOVER),
@ -1144,15 +1145,18 @@ void CInGameConsole::startEnteringText()
GH.statusbar->setEnteredText(enteredText);
}
void CInGameConsole::endEnteringText(bool printEnteredText)
void CInGameConsole::endEnteringText(bool processEnteredText)
{
captureAllKeys = false;
prevEntDisp = -1;
if(printEnteredText)
if(processEnteredText)
{
std::string txt = enteredText.substr(0, enteredText.size()-1);
LOCPLINT->cb->sendMessage(txt, LOCPLINT->getSelection());
previouslyEntered.push_back(txt);
boost::thread clientCommandThread(ClientCommandManager::processCommand, txt, true);
clientCommandThread.join();
}
enteredText.clear();