QTfrontend/newnetclient.cpp
changeset 320 1ee7f087195a
parent 319 7f3bd9e31f18
child 322 e7175ae57945
equal deleted inserted replaced
319:7f3bd9e31f18 320:1ee7f087195a
   128 }
   128 }
   129 
   129 
   130 void HWNewNet::ParseLine(const QByteArray & line)
   130 void HWNewNet::ParseLine(const QByteArray & line)
   131 {
   131 {
   132   QString msg = QString::fromUtf8 (line.data(), line.size());
   132   QString msg = QString::fromUtf8 (line.data(), line.size());
   133   
   133 
   134   qDebug() << "line " << msg << " received";
   134   qDebug() << "line " << msg << " received";
   135 
   135 
   136   QStringList lst = msg.split(delimeter);
   136   QStringList lst = msg.split(delimeter);
   137   if (lst[0] == "ERRONEUSNICKNAME") {
   137   if (lst[0] == "ERRONEUSNICKNAME") {
   138     QMessageBox::information(0, 0, "Your net nickname is in use or cannot be used");
   138     QMessageBox::information(0, 0, "Your net nickname is in use or cannot be used");
   153 
   153 
   154   if (lst[0] == "CONFIGASKED") {
   154   if (lst[0] == "CONFIGASKED") {
   155     ConfigAsked();
   155     ConfigAsked();
   156     return;
   156     return;
   157   }
   157   }
   158   
   158 
   159   if (lst[0] == "CONFIGURED") {
   159   if (lst[0] == "CONFIGURED") {
   160     lst.pop_front();
   160     lst.pop_front();
   161     RunGame();
   161     RunGame();
   162     qDebug() << lst[0];
   162     qDebug() << lst[0];
   163     QByteArray ar=QByteArray::fromBase64(lst[0].toAscii());
   163     QByteArray ar=QByteArray::fromBase64(lst[0].toAscii());
   164     emit FromNet(ar);
   164     emit FromNet(ar);
   165     
   165 
   166     lst.pop_front();
   166     lst.pop_front();
   167     QByteArray cache;
   167     QByteArray cache;
   168     emit FromNet(HWProto::addStringListToBuffer(cache, lst));
   168     emit FromNet(HWProto::addStringListToBuffer(cache, lst));
   169     return;
   169     return;
   170   }
   170   }
   179 {
   179 {
   180   QByteArray cache;
   180   QByteArray cache;
   181   HWProto::addStringToBuffer(cache, "eseed " + seed);
   181   HWProto::addStringToBuffer(cache, "eseed " + seed);
   182   HWProto::addStringToBuffer(cache, "TN");
   182   HWProto::addStringToBuffer(cache, "TN");
   183   HWProto::addStringToBuffer(cache, "e$gmflags 0");
   183   HWProto::addStringToBuffer(cache, "e$gmflags 0");
   184   HWProto::addStringToBuffer(cache, QString("etheme %1").arg(config->GetRandomTheme()));
   184   HWProto::addStringToBuffer(cache, QString("etheme steel"));
   185   QString _msg = QString("CONFIGANSWER") + delimeter + QString(cache.toBase64());
   185   QString _msg = QString("CONFIGANSWER") + delimeter + QString(cache.toBase64());
   186   RawSendNet(_msg);
   186   RawSendNet(_msg);
   187 }
   187 }
   188 
   188 
   189 void HWNewNet::RunGame()
   189 void HWNewNet::RunGame()