QTfrontend/game.cpp
changeset 2786 85f6425a4d74
parent 2747 7889a3a9724f
child 2948 3f21a9dc93d0
equal deleted inserted replaced
2785:de6406cd6b25 2786:85f6425a4d74
   134 void HWGame::SendTrainingConfig()
   134 void HWGame::SendTrainingConfig()
   135 {
   135 {
   136 	QByteArray traincfg;
   136 	QByteArray traincfg;
   137 	HWProto::addStringToBuffer(traincfg, "TL");
   137 	HWProto::addStringToBuffer(traincfg, "TL");
   138 
   138 
   139 	QFile file(datadir->absolutePath() + "/Trainings/" + training + ".txt");
   139 	HWProto::addStringToBuffer(traincfg, "escript " + datadir->absolutePath() + "/Missions/" + training + ".hwt");
   140 	if(!file.open(QFile::ReadOnly))
       
   141 	{
       
   142 		emit ErrorMessage(tr("Error reading training config file"));
       
   143 		return;
       
   144 	}
       
   145 
       
   146 	QTextStream stream(&file);
       
   147 	while(!stream.atEnd())
       
   148 	{
       
   149 		QString line = stream.readLine();
       
   150 		if(!line.isEmpty() && !line.startsWith("#"))
       
   151 			if(line != "<binds>")
       
   152 				HWProto::addStringToBuffer(traincfg, "e" + line);
       
   153 			else
       
   154 				for(int i = 0; i < BINDS_NUMBER; i++)
       
   155 					if(!cbinds[i].strbind.isEmpty())
       
   156 						HWProto::addStringToBuffer(traincfg, "ebind " + cbinds[i].strbind + " " + cbinds[i].action);
       
   157 	}
       
   158 
   140 
   159 	RawSendIPC(traincfg);
   141 	RawSendIPC(traincfg);
   160 }
   142 }
   161 
   143 
   162 void HWGame::SendNetConfig()
   144 void HWGame::SendNetConfig()