QTfrontend/game.cpp
changeset 425 a7e1dabc8fb7
parent 419 fdeed9718e6b
child 466 bc45a038d47a
equal deleted inserted replaced
424:4598c21bb421 425:a7e1dabc8fb7
   143 				}
   143 				}
   144 			}
   144 			}
   145 			break;
   145 			break;
   146 		}
   146 		}
   147 		case 'E': {
   147 		case 'E': {
   148 			QMessageBox::critical(0,
   148 			emit ErrorMessage(QString().append(msg.mid(2)).left(msg.size() - 6));
   149 					"Hedgewars: error message",
       
   150 					QString().append(msg.mid(2)).left(msg.size() - 6),
       
   151 					QMessageBox::Ok,
       
   152 					QMessageBox::NoButton,
       
   153 					QMessageBox::NoButton);
       
   154 			return;
   149 			return;
   155 		}
   150 		}
   156 		case 'K': {
   151 		case 'K': {
   157 			ulong kb = msg.mid(2).toULong();
   152 			ulong kb = msg.mid(2).toULong();
   158 			if (kb && kb <= KBmsgsCount)
   153 			if (kb && kb <= KBmsgsCount)
   159 			{
   154 			{
   160 				QMessageBox::information(0,
   155 				emit ErrorMessage(KBMessages[kb - 1]);
   161 						"Hedgewars: information",
       
   162 						KBMessages[kb - 1],
       
   163 						QMessageBox::Ok,
       
   164 						QMessageBox::NoButton,
       
   165 						QMessageBox::NoButton);
       
   166 			}
   156 			}
   167 			return;
   157 			return;
   168 		}
   158 		}
   169 		case '+': {
   159 		case '+': {
   170 			if (gameType == gtNet)
   160 			if (gameType == gtNet)
   243 	demo->replace(QByteArray("\x02TN"), QByteArray("\x02TD"));
   233 	demo->replace(QByteArray("\x02TN"), QByteArray("\x02TD"));
   244 
   234 
   245 	QFile demofile(filename);
   235 	QFile demofile(filename);
   246 	if (!demofile.open(QIODevice::WriteOnly))
   236 	if (!demofile.open(QIODevice::WriteOnly))
   247 	{
   237 	{
   248 		QMessageBox::critical(0,
   238 		emit ErrorMessage(tr("Cannot save demo to file %1").arg(filename));
   249 				tr("Error"),
       
   250 				tr("Cannot save demo to file %1").arg(filename),
       
   251 				tr("Quit"));
       
   252 		return ;
   239 		return ;
   253 	}
   240 	}
   254 	QDataStream stream(&demofile);
   241 	QDataStream stream(&demofile);
   255 	stream.writeRawData(demo->constData(), demo->size());
   242 	stream.writeRawData(demo->constData(), demo->size());
   256 	demofile.close();
   243 	demofile.close();
   262 {
   249 {
   263 	gameType = gtDemo;
   250 	gameType = gtDemo;
   264 	QFile demofile(demofilename);
   251 	QFile demofile(demofilename);
   265 	if (!demofile.open(QIODevice::ReadOnly))
   252 	if (!demofile.open(QIODevice::ReadOnly))
   266 	{
   253 	{
   267 		QMessageBox::critical(0,
   254 		emit ErrorMessage(tr("Cannot open demofile %1").arg(demofilename));
   268 				tr("Error"),
       
   269 				tr("Cannot open demofile %1").arg(demofilename),
       
   270 				tr("Quit"));
       
   271 		return ;
   255 		return ;
   272 	}
   256 	}
   273 
   257 
   274 	// read demo
   258 	// read demo
   275 	QDataStream stream(&demofile);
   259 	QDataStream stream(&demofile);