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

📄 parser.cpp

📁 qgo-1.5.4-r3.tar.gz linux下一个很好玩的游戏
💻 CPP
📖 第 1 页 / 共 3 页
字号:
			{				// the following lines are help messages				memory_str = line;				// check if NNGS message cmd is active -> see '9 Messages:'				if (memory != 14)					memory = 8;			}			return HELP;			break;		// INFO: stats, channelinfo		// NNGS, LGS: (NNGS new: 2nd line w/o number!)		//	9 Channel 20 Topic: [xxx] don't pay your NIC bill and only get two players connected		//	9  xxxx1 xxxx2 xxxx3 xxxx4 frosla		//	9 Channel 49 Topic: Der deutsche Kanal (German)		//	9  frosla		//		//	-->  channel 49		//	9 Channel 49 turned on.		//	9 Channel 49 Title:		//		//	9 guest has left channel 49.		//		//	9 Komi set to -3.5 in match 10		// - in my game:		// -   opponent:		//      9 Komi is now set to -3.5		// -   me:		//      9 Set the komi to -3.5		// NNGS, LGS:		//	9 I suggest that ditto play White against made:		//	9 For 19x19:  Play an even game and set komi to 1.5.		//	9 For 13x13:  Play an even game and set komi to 6.5.		//	9 For   9x9:  Play an even game and set komi to 4.5.		// or:		//	9 I suggest that pem play Black against eek:		//	For 19x19:  Take 3 handicap stones and set komi to -2.5.		//	For 13x13:  Take 1 handicap stones and set komi to -6.5.		//	For   9x9:  Take 1 handicap stones and set komi to 0.5.		// or:		//	   I suggest that you play White against Cut:		//		//	9 Match [19x19] in 1 minutes requested with xxxx as White.		//	9 Use <match xxxx B 19 1 10> or <decline xxxx> to respond.		//		//	9 Match [5] with guest17 in 1 accepted.		//	9 Creating match [5] with guest17.		//		//	9 Requesting match in 10 min with frosla as Black.		//	9 guest17 declines your request for a match.		//	9 frosla withdraws the match offer.		//		//	9 You can check your score with the score command		//	9 You can check your score with the score command, type 'done' when finished.		//	9 Removing @ K8		//		//	9 Use adjourn to adjourn the game.		//		// NNGS: cmd 'user' NOT PARSED!		//	9  Info     Name       Rank  19  9  Idle Rank Info		//	9  -------- ---------- ---- --- --- ---- ---------------------------------		//	9  Q  --  5 hhhsss      2k*   0   0  1s  NR                                    		//	9     --  5 saturn      2k    0   0 18s  2k                                    		//	9     --  6 change1     1k*   0   0  7s  NR                                    		//	9 S   -- -- mikke       1d    0  18 30s  shodan in sweden                      		//	9   X -- -- ksonney     NR    0   0 56s  NR                                    		//	9     -- -- kou         6k*   0   0 23s  NR                                    		//	9 SQ! -- -- GnuGo      11k*   0   0  5m  Estimation based on NNGS rating early 		//	9   X -- -- Maurice     3k*   0   0 24s  2d at Hamilton Go Club, Canada; 3d in 		case 9:			// status messages			if (line.contains("Set open to be"))			{				bool val = (line.find("False") == -1);				emit signal_checkbox(0, val);			}			else if (line.contains("Setting you open for matches"))				emit signal_checkbox(0, true);			else if (line.contains("Set looking to be"))			{				bool val = (line.find("False") == -1);				emit signal_checkbox(1, val);			}			// 9 Set quiet to be False.			else if (line.contains("Set quiet to be"))			{				bool val = (line.find("False") == -1);				emit signal_checkbox(2, val);			}			else if (line.find("Channel") == 0) 			{				// channel messages				QString e1 = element(line, 1, " ");				if (e1.at(e1.length()-1) == ':')					e1.truncate(e1.length()-1);				int nr = e1.toInt();				if (line.contains("turned on."))				{					// turn on channel					emit signal_channelinfo(nr, QString("*on*"));				}				else if (line.contains("turned off."))				{					// turn off channel					emit signal_channelinfo(nr, QString("*off*"));				}				else if (!line.contains("Title:") || gsName == GS_UNKNOWN)				{					// keep in memory to parse next line correct					memory = nr;					emit signal_channelinfo(memory, line);					memory_str = "CHANNEL";				}//				return IT_OTHER;			}			else if (memory != 0 && memory_str && memory_str == "CHANNEL")			{				emit signal_channelinfo(memory, line);				// reset memory				memory = 0;				memory_str = QString();//				return IT_OTHER;			}			// IGS: channelinfo			// 9 #42 Title: Untitled -- Open			// 9 #42    broesel    zero815     Granit			else if (line.contains("#"))			{				int nr = element(line, 0, "#", " ").toInt();				QString msg = element(line, 0, " ", "EOL");				emit signal_channelinfo(nr, msg);			}			// NNGS: channels			else if (line.contains("has left channel") || line.contains("has joined channel"))			{				QString e1 = element(line, 3, " ", ".");				int nr = e1.toInt();				// turn on channel to get full info				emit signal_channelinfo(nr, QString("*on*"));			}			else if (line.contains("Game is titled:"))			{				QString t = element(line, 0, ":", "EOL");				emit signal_title(t);				return IT_OTHER;			}			else if (line.contains("offers a new komi "))			{				// NNGS: 9 physician offers a new komi of 1.5.				QString komi = element(line, 6, " ");				if (komi.at(komi.length()-1) == '.')					komi.truncate(komi.length() - 1);				QString opponent = element(line, 0, " ");				// true: request				emit signal_komi(opponent, komi, true);			}			else if (line.contains("Komi set to"))			{				// NNGS: 9 Komi set to -3.5 in match 10				QString komi = element(line, 3, " ");				QString game_id = element(line, 6, " ");				// false: no request				emit signal_komi(game_id, komi, false);			}			else if (line.contains("wants the komi to be"))			{				// IGS: 9 qGoDev wants the komi to be  1.5				QString komi = element(line, 6, " ");				QString opponent = element(line, 0, " ");				// true: request				emit signal_komi(opponent, komi, true);			}			else if (line.contains("Komi is now set to"))			{				// 9 Komi is now set to -3.5. -> oppenent set for our game				QString komi = element(line, 5, " ");				// error? "9 Komi is now set to -3.5.9 Komi is now set to -3.5"				if (komi.contains(".9"))					komi = komi.left(komi.length() - 2);				// false: no request				emit signal_komi(QString(), komi, false);			}			else if (line.contains("Set the komi to"))			{				// NNGS: 9 Set the komi to -3.5 - I set for own game				QString komi = element(line, 4, " ");				// false: no request				emit signal_komi(QString(), komi, false);			}			else if (line.contains("game will count"))			{				// IGS: 9 Game will not count towards ratings.				//      9 Game will count towards ratings.				emit signal_freegame(false);			}			else if (line.contains("game will not count", false))			{				// IGS: 9 Game will not count towards ratings.				//      9 Game will count towards ratings.				emit signal_freegame(true);			}			else if ((line.contains("[") || line.contains("yes")) && line.length() < 6)			{				// 9 [20] ... channelinfo				// 9 yes  ... ayt				return IT_OTHER;			}			else if (line.contains("has restarted your game") ||			         line.contains("has restored your old game"))			{				if (line.contains("restarted"))					// memory_str -> see case 15 for continuation					memory_str = element(line, 0, " ");			}			else if (line.contains("I suggest that"))			{				memory_str = line;				return IT_OTHER;			}			else if (line.contains("and set komi to"))			{				// suggest message ...				if (!memory_str)					// something went wrong...					return IT_OTHER;				line = line.simplifyWhiteSpace();				QString p1 = element(memory_str, 3, " ");				QString p2 = element(memory_str, 6, " ", ":");				bool p1_play_white = memory_str.contains("play White");				QString h, k;				if (line.contains("even game"))					h = "0";				else					h = element(line, 3, " ");				k = element(line, 9, " ", ".");				int size = 19;				if (line.contains("13x13"))					size = 13;				else if (line.contains("9x 9"))				{					size = 9;					memory_str = QString();				}				if (p1_play_white)					emit signal_suggest(p1, p2, h, k, size);				else					emit signal_suggest(p2, p1, h, k, size);				return IT_OTHER;			}			// 9 Match [19x19] in 1 minutes requested with xxxx as White.			// 9 Use <match xxxx B 19 1 10> or <decline xxxx> to respond.			// 9 NMatch requested with yfh2test(B 3 19 60 600 25 0 0 0).			// 9 Use <nmatch yfh2test B 3 19 60 600 25 0 0 0> or <decline yfh2test> to respond.			else if (line.contains("<decline") && line.contains("match"))			{				// false -> not my request: used in mainwin.cpp				emit signal_matchrequest(element(line, 0, "<", ">"), false);			}			// 9 Match [5] with guest17 in 1 accepted.			// 9 Creating match [5] with guest17.			else if (line.contains("Creating match"))			{				QString nr = element(line, 0, "[", "]");				// maybe there's a blank within the brackets: ...[ 5]...				QString dummy = element(line, 0, "]", ".").stripWhiteSpace();				QString opp = element(dummy, 1, " ");				emit signal_matchcreate(nr, opp);        			// automatic opening of a dialog tab for further conversation        			emit signal_talk(opp, "", true);			}			else if (line.contains("Match") && line.contains("accepted"))			{				QString nr = element(line, 0, "[", "]");				QString opp = element(line, 3, " ");				emit signal_matchcreate(nr, opp);        			}			// 9 frosla withdraws the match offer.			// 9 guest17 declines your request for a match.				else if (line.contains("declines your request for a match") ||				 line.contains("withdraws the match offer"))			{				QString opp = element(line, 0, " ");				emit signal_notopen(opp);			}			//9 yfh2test declines undo			else if (line.contains("declines undo"))			{				// not the cleanest way : we should send this to a message box				emit signal_kibitz(0, element(line, 0, " "), line);				return KIBITZ;			}					//9 yfh2test left this room			//9 yfh2test entered this room			else if (line.contains("this room"))				emit signal_refresh(10);							//9 Requesting match in 10 min with frosla as Black.			else if (line.contains("Requesting match in"))			{				QString opp = element(line, 6, " ");				emit signal_opponentopen(opp);			}			// NNGS: 9 Removing @ K8			// IGS:	9 Removing @ B5			//     49 Game 265 qGoDev is removing @ B5			else if (line.contains("emoving @"))			{				if (gsName != IGS)				{					QString pt = element(line, 2, " ");					emit signal_removestones(pt, 0);				}			}			// 9 You can check your score with the score command, type 'done' when finished.			else if (line.contains("check your score with the score command"))			{//				if (gsName == IGS)					// IGS: store and wait until game number is known//					memory_str = QString("rmv@"); // -> continuation see 15//				else					emit signal_removestones(0, 0);			}			// IGS: 9 Board is restored to what it was when you started scoring			else if (line.contains("what it was when you"))			{				emit signal_removestones(0, 0);			}			// WING: 9 Use <adjourn> to adjourn, or <decline adjourn> to decline.			else if (line.contains("Use adjourn to") || line.contains("Use <adjourn> to"))			{qDebug("parser->case 9: Use adjourn to");				emit signal_requestDialog("adjourn", 0, 0, 0);			}			// 9 frosla requests to pause the game.			else if (line.contains("requests to pause"))			{				emit signal_requestDialog("pause", 0, 0, 0);			}			else if (line.contains("been adjourned"))			{				// remove game from list - special case: own game				aGame->nr = "@";				aGame->running = false;				emit signal_game(aGame);			}			// 9 Game 22: frosla vs frosla has adjourned.			else if (line.contains("has adjourned"))

⌨️ 快捷键说明

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