QTfrontend/newnetclient.cpp
changeset 339 7535ab6c3820
parent 338 d1e75dcd285f
child 341 184230eb4151
equal deleted inserted replaced
338:d1e75dcd285f 339:7535ab6c3820
    25 #include "game.h"
    25 #include "game.h"
    26 #include "gamecfgwidget.h"
    26 #include "gamecfgwidget.h"
    27 
    27 
    28 char delimeter='\t';
    28 char delimeter='\t';
    29 
    29 
    30 HWNewNet::HWNewNet(GameUIConfig * config, GameCFGWidget* pGameCFGWidget) :
    30 HWNewNet::HWNewNet(GameUIConfig * config, GameCFGWidget* pGameCFGWidget, TeamSelWidget* pTeamSelWidget) :
    31   config(config),
    31   config(config),
    32   m_pGameCFGWidget(pGameCFGWidget),
    32   m_pGameCFGWidget(pGameCFGWidget),
       
    33   m_pTeamSelWidget(pTeamSelWidget),
    33   isChief(false)
    34   isChief(false)
    34 {
    35 {
    35   connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
    36   connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
    36   connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect()));
    37   connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect()));
    37   connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect()));
    38   connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect()));
   145     return;
   146     return;
   146   }
   147   }
   147 
   148 
   148   if (lst[0] == "ADDTEAM:") {
   149   if (lst[0] == "ADDTEAM:") {
   149     lst.pop_front();
   150     lst.pop_front();
   150     emit AddNetTeam(lst[0]);
   151     emit AddNetTeam(lst);
   151     return;
   152     return;
   152   }
   153   }
   153 
   154 
   154   if (lst[0] == "CONFIGASKED") {
   155   if (lst[0] == "CONFIGASKED") {
   155     isChief=true;
   156     isChief=true;
   156     ConfigAsked();
   157     ConfigAsked();
   157     return;
   158     return;
       
   159   }
       
   160 
       
   161   if (lst[0] == "RUNGAME") {
       
   162     HWGame* game = new HWGame(config, m_pGameCFGWidget, m_pTeamSelWidget); // FIXME: memory leak here (stackify it?)
       
   163     connect(game, SIGNAL(SendNet(const QByteArray &)), this, SLOT(SendNet(const QByteArray &)));
       
   164     connect(this, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));
       
   165     connect(this, SIGNAL(LocalCFG(const QString &)), game, SLOT(LocalCFG(const QString &)));
       
   166     game->StartNet();
   158   }
   167   }
   159 
   168 
   160   if (lst[0] == "CONFIGURED") {
   169   if (lst[0] == "CONFIGURED") {
   161     lst.pop_front();
   170     lst.pop_front();
   162     if(lst.size()<5) return;
   171     if(lst.size()<5) return;