瀏覽代碼

Fix assertion failure in in-game console

Ivan Savenko 2 年之前
父節點
當前提交
0abc00f82e
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      client/adventureMap/CInGameConsole.cpp

+ 11 - 1
client/adventureMap/CInGameConsole.cpp

@@ -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);