1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix assertion failure in in-game console

This commit is contained in:
Ivan Savenko 2023-04-08 18:53:47 +03:00
parent 3dedc963f7
commit 0abc00f82e

View File

@ -38,6 +38,9 @@ void CInGameConsole::showAll(SDL_Surface * to)
void CInGameConsole::show(SDL_Surface * to)
{
if (LOCPLINT->cingconsole != this)
return;
int number = 0;
boost::unique_lock<boost::mutex> lock(texts_mx);
@ -107,7 +110,11 @@ void CInGameConsole::print(const std::string & txt)
void CInGameConsole::keyPressed (const SDL_Keycode & key)
{
if(!captureAllKeys && key != SDLK_TAB) return; //because user is not entering any text
if (LOCPLINT->cingconsole != this)
return;
if(!captureAllKeys && key != SDLK_TAB)
return; //because user is not entering any text
switch(key)
{
@ -192,6 +199,9 @@ void CInGameConsole::keyPressed (const SDL_Keycode & key)
void CInGameConsole::textInputed(const std::string & inputtedText)
{
if (LOCPLINT->cingconsole != this)
return;
if(!captureAllKeys || enteredText.empty())
return;
enteredText.resize(enteredText.size()-1);