QTfrontend/game.cpp
changeset 1358 99ba722e5a09
parent 1356 77ab8735401d
child 1369 f5b1b3fd70cc
equal deleted inserted replaced
1357:5b9012dd4a05 1358:99ba722e5a09
   155 	commonConfig();
   155 	commonConfig();
   156 }
   156 }
   157 
   157 
   158 void HWGame::ParseMessage(const QByteArray & msg)
   158 void HWGame::ParseMessage(const QByteArray & msg)
   159 {
   159 {
       
   160 qDebug() << msg;
   160 	switch(msg.at(1)) {
   161 	switch(msg.at(1)) {
   161 		case '?': {
   162 		case '?': {
   162 			SendIPC("!");
   163 			SendIPC("!");
   163 			break;
   164 			break;
   164 		}
   165 		}
   165 		case 'C': {
   166 		case 'C': {
   166 			switch (gameType) {
   167 			switch (gameType) {
   167 				case gtLocal: {
   168 				case gtLocal: {
   168 				 	SendConfig();
   169 					SendConfig();
   169 					break;
   170 					break;
   170 				}
   171 				}
   171 				case gtQLocal: {
   172 				case gtQLocal: {
   172 				 	SendQuickConfig();
   173 					SendQuickConfig();
   173 					break;
   174 					break;
   174 				}
   175 				}
   175 				case gtDemo: break;
   176 				case gtDemo: break;
   176 				case gtNet: {
   177 				case gtNet: {
   177 					SendNetConfig();
   178 					SendNetConfig();
   178 					break;
   179 					break;
   179 				}
   180 				}
   180 				case gtTraining: {
   181 				case gtTraining: {
   181 				 	SendTrainingConfig();
   182 					SendTrainingConfig();
   182 					break;
   183 					break;
   183 				}
   184 				}
   184 			}
   185 			}
   185 			break;
   186 			break;
   186 		}
   187 		}
   214 			SetGameState(gsFinished);
   215 			SetGameState(gsFinished);
   215 			break;
   216 			break;
   216 		}
   217 		}
   217 		case 's': {
   218 		case 's': {
   218 			int size = msg.size();
   219 			int size = msg.size();
   219 			emit SendChat(QString::fromUtf8(msg.mid(2).left(size - 4)));
   220 			QString msgbody = QString::fromUtf8(msg.mid(2).left(size - 4));
       
   221 			emit SendChat(msgbody);
       
   222 			QByteArray buf;
       
   223 			HWProto::addStringToBuffer(buf, QString("s%1: %2\x20\x20").arg(config->netNick()).arg(msgbody));
       
   224 			demo.append(buf);
       
   225 			break;
   220 		}
   226 		}
   221 		default: {
   227 		default: {
   222 			if (gameType == gtNet)
   228 			if (gameType == gtNet)
   223 			{
   229 			{
   224 				emit SendNet(msg);
   230 				emit SendNet(msg);
   225 			}
   231 			}
       
   232 		if (msg.at(1) != 's')
   226 			demo.append(msg);
   233 			demo.append(msg);
   227 		}
   234 		}
   228 	}
   235 	}
   229 }
   236 }
   230 
   237