mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Fix assertion failure in in-game console
This commit is contained in:
		| @@ -38,6 +38,9 @@ void CInGameConsole::showAll(SDL_Surface * to) | |||||||
|  |  | ||||||
| void CInGameConsole::show(SDL_Surface * to) | void CInGameConsole::show(SDL_Surface * to) | ||||||
| { | { | ||||||
|  | 	if (LOCPLINT->cingconsole != this) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	int number = 0; | 	int number = 0; | ||||||
|  |  | ||||||
| 	boost::unique_lock<boost::mutex> lock(texts_mx); | 	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) | 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) | 	switch(key) | ||||||
| 	{ | 	{ | ||||||
| @@ -192,6 +199,9 @@ void CInGameConsole::keyPressed (const SDL_Keycode & key) | |||||||
|  |  | ||||||
| void CInGameConsole::textInputed(const std::string & inputtedText) | void CInGameConsole::textInputed(const std::string & inputtedText) | ||||||
| { | { | ||||||
|  | 	if (LOCPLINT->cingconsole != this) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	if(!captureAllKeys || enteredText.empty()) | 	if(!captureAllKeys || enteredText.empty()) | ||||||
| 		return; | 		return; | ||||||
| 	enteredText.resize(enteredText.size()-1); | 	enteredText.resize(enteredText.size()-1); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user