⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parser.cpp

📁 qgo-1.5.4-r3.tar.gz linux下一个很好玩的游戏
💻 CPP
📖 第 1 页 / 共 3 页
字号:
			{				// remove game from list				aGame->nr = element(line, 0, " ", ":");				aGame->running = false;				// for information				aGame->Sz = "has adjourned.";				emit signal_game(aGame);				emit signal_move(aGame);			}			// 9 Removing game 30 from observation list.			else if (line.contains("from observation list"))			{				// is done from qGoIF				// emit signal_addToObservationList(-1);				aGame->nr = element(line, 2, " ");				aGame->Sz = "-";				aGame->running = false;				emit signal_move(aGame);				return IT_OTHER;			}			// 9 Adding game to observation list.			else if (line.contains("to observation list"))			{				// is done from qGoIF				// emit signal_addToObservationList(-2);				return IT_OTHER;			}			// 9 Games currently being observed:  31, 36, 45.			else if (line.contains("Games currently being observed"))			{				if (line.contains("None"))				{					emit signal_addToObservationList(0);				}				else				{					// don't work correct at IGS!!!					int i = line.contains(',');					qDebug(QString("observing %1 games").arg(i+1));//					emit signal_addToObservationList(i+1);				}//				return IT_OTHER;			}			// 9 1 minutes were added to your opponents clock			else if (line.contains("minutes were added"))			{				int t = element(line, 0, " ").toInt();				emit signal_timeAdded(t, false);			}			// 9 Your opponent has added 1 minutes to your clock.			else if (line.contains("opponent has added"))			{				int t = element(line, 4, " ").toInt();				emit signal_timeAdded(t, true);			}			// NNGS: 9 Game clock paused. Use "unpause" to resume.			else if (line.contains("Game clock paused"))			{				emit signal_timeAdded(-1, true);			}			// NNGS: 9 Game clock resumed.			else if (line.contains("Game clock resumed"))			{				emit signal_timeAdded(-1, false);			}			// 9 Increase frosla's time by 1 minute			else if (line.contains("s time by"))			{				int t = element(line, 4, " ").toInt();				if (line.contains(myname))					emit signal_timeAdded(t, true);				else					emit signal_timeAdded(t, false);			}			// 9 Setting your . to Banana  [text] (idle: 0 minutes)			else if (line.contains("Setting your . to"))			{				QString busy = element(line, 0, "[", "]");				if (busy)				{					QString player = element(line, 4, " ");					// true = player					emit signal_talk(player, "[" + busy + "]", true);				}			}			// NNGS: 9 Messages: (after 'message' cmd)			//       8 File			//       <msg>			//       8 File			//       9 Please type "erase" to erase your messages after reading			else if (line.contains("Messages:"))			{				// parse like IGS cmd nr 14: Messages				memory = 14;			}			// IGS:  9 You have a message. To read your messages, type:  message			// NNGS: 9 You have 1 messages.  Type "messages" to display them			else if (line.contains("You have") && line.contains("messages"))			{				// remove cmd nr				line = txt.stripWhiteSpace();				line = line.remove(0, 2);				emit signal_message(line);				return YOUHAVEMSG;			}			// 9 Observing game  2 (chmeng vs. myao) :			// 9        shanghai  9k*           henry 15k  			// 9 Found 2 observers.			else if (line.contains("Observing game ", true))			{				// right now: only need for observers of teaching game				// game number				bool ok;				memory = element(line, 2, " ").toInt(&ok);				if (ok)				{					memory_str = "observe";					// send as kibitz from "0" -> init					emit signal_kibitz(memory, "0", "0"); 					return KIBITZ;				}			}			else if (memory_str && memory_str == "observe" && line.contains("."))			{//				QString cnt = element(line, 1, " ");				emit signal_kibitz(memory, "00", "");				memory = 0;				memory_str = QString();				return KIBITZ;			}			else if (memory_str && memory_str == "observe")			{				QString name;				QString rank;				for (int i = 0; name = element(line, i, " "); i++)				{					rank = element(line, ++i, " ");					// send as kibitz from "0"					emit signal_kibitz(memory, "0", name + " " + rank);				}				return KIBITZ;			}			else if (line.contains("****") && line.contains("Players"))			{				// maybe last line of a 'user' cmd				aPlayer->extInfo = "";				aPlayer->won = "";				aPlayer->lost = "";				aPlayer->country = "";				aPlayer->nmatch_settings = "";				// remove cmd nr				//line = txt.stripWhiteSpace();				//line = line.remove(0, 2);				//emit signal_message(line);				return PLAYER42_END;			}			// 9 qGoDev has resigned the game.			else if ((line.contains("has resigned the game"))||				(line.contains("has run out of time")))			{				aGame->nr = "@";				aGame->running = false;							aGame->Sz = line ;							emit signal_move(aGame);				break;				// make better check				//if (element(line, 0, " ", "EOL") != QString("has resigned the game."))				//{				//	qDebug("'has resigned the game.' ... but pattern wrong");				//}				//else				//	emit signal_kibitz(0, element(line, 0, " "), line);			}			//eb5 has run out of time.			//else if (line.contains("has run out of time"))			//{			//	emit signal_kibitz(0, element(line, 0, " "), line);			//}      //9 Player:      yfh2      //9 Game:        go (1)      //9 Language:    default      //9 Rating:      6k*  23      //9 Rated Games:     21      //9 Rank:  8k  21      //9 Wins:        13      //9 Losses:      16      //9 Idle Time:  (On server) 0s      //9 Address:  yfh2@tiscali.fr      //9 Country:  France      //9 Reg date: Tue Nov 18 04:01:05 2003      //9 Info:  yfh2      //9 Defaults (help defs):  time 0, size 0, byo-yomi time 0, byo-yomi stones 0      //9 Verbose  Bell  Quiet  Shout  Automail  Open  Looking  Client  Kibitz  Chatter      //9     Off    On     On     On        On   Off      Off      On      On   On      else if (line.contains("Player:"))       {        statsPlayer->name = element(line, 1, " ");        statsPlayer->extInfo = "";	statsPlayer->won = "";	statsPlayer->lost = "";	statsPlayer->country = "";	statsPlayer->nmatch_settings = "";	statsPlayer->rank = "";	statsPlayer->info = "";        statsPlayer->address = "";	statsPlayer->play_str = "";	statsPlayer->obs_str = "";	statsPlayer->idle = "";        statsPlayer->rated = "";        // not sure it is the best way : above code seem to make use of "signal"        // but we don't need this apparently for handling stats        memory_str = "STATS";        return STATS ;        }            else if (line.contains("Address:"))        {         statsPlayer->address = element(line, 1, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }      else if (line.contains("Last Access"))        {         statsPlayer->idle = element(line, 4, " ")+ " " + element(line, 5, " ")+" " + element(line, 6, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }		else if (line.contains("Rating:"))        {         statsPlayer->rank = element(line, 1, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }      else if (line.contains("Wins:"))        {         statsPlayer->won = element(line, 1, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;                 }              else if (line.contains("Losses:"))        {         statsPlayer->lost = element(line, 1, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;          }      else if ((line.contains("Country:"))||(line.contains("From:")))   //IGS || LGS        {         statsPlayer->country = element(line, 0, " ","EOL");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;         }      else if (line.contains("Defaults"))    //IGS        {         statsPlayer->extInfo = element(line, 2, " ","EOL");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;         }      else if (line.contains("Experience on WING"))  //WING        {         statsPlayer->extInfo = line ;         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }      else if (line.contains("User Level:")) //LGS        {         statsPlayer->extInfo = line ;         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }              else if ((line.contains("Info:"))&& !(line.contains("Rank Info:")))        {         if (! statsPlayer->info.isEmpty())           statsPlayer->info.append("\n");         statsPlayer->info.append(line);         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;                  }      else if (line.contains("Playing in game:"))       //IGS and LGS        {         statsPlayer->play_str = element(line, 3, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }      else if (line.contains("(playing game"))       //WING        {         statsPlayer->play_str = element(line, 1, " ",":");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }                      else if (line.contains("Rated Games:"))        {         statsPlayer->rated = element(line, 2, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }              else if (line.contains("Games Rated:"))    //WING syntax        {         statsPlayer->rated = element(line, 2, " ");         statsPlayer->won = element(line, 0, "("," ");         statsPlayer->lost = element(line, 6, " ");                  emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }              else if (line.contains("Idle Time:"))        {         if    (gsName == WING)            statsPlayer->idle = element(line, 2, " ");         else            statsPlayer->idle = element(line, 4, " ");                     emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }      else if (line.contains("Last Access"))        {         statsPlayer->idle = "not on";         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }              else if (line.left(5) == "19x19")     //LGS syntax        {         statsPlayer->rank = element(line, 4, " ");         statsPlayer->rated = element(line, 7, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }      else if (line.contains("Wins/Losses"))     //LGS syntax        {         statsPlayer->won = element(line, 2, " ");         statsPlayer->lost = element(line, 4, " ");         emit signal_statsPlayer(statsPlayer);         return IT_OTHER ;        }	//9 ROOM 01: FREE GAME ROOM;PSMNYACF;帺桼懳嬊幒;19;1;10;1,19,60,600,30,25,10,60,0	//9 ROOM 10: SLOW GAME ROOM;PSMNYACF;桔皯螊菐

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -