QTfrontend/game.cpp
changeset 5865 35387d27f73a
parent 5781 1fa54e5ea479
child 6015 daffc14a518a
equal deleted inserted replaced
5864:6cc72b333c5f 5865:35387d27f73a
    51 }
    51 }
    52 
    52 
    53 void HWGame::onClientDisconnect()
    53 void HWGame::onClientDisconnect()
    54 {
    54 {
    55     switch (gameType) {
    55     switch (gameType) {
    56         case gtDemo: 
    56         case gtSave:
    57             if (gameState == gsInterrupted || gameState == gsHalted) emit HaveRecord(false, demo);
    57             if (gameState == gsInterrupted || gameState == gsHalted)
       
    58                 emit HaveRecord(false, demo);
       
    59             else if (gameState == gsFinished)
       
    60                  emit HaveRecord(true, demo);
       
    61             break;
       
    62         case gtDemo:
    58             break;
    63             break;
    59         case gtNet:
    64         case gtNet:
    60             emit HaveRecord(true, demo);
    65             emit HaveRecord(true, demo);
    61             break;
    66             break;
    62         default:
    67         default:
   186                 }
   191                 }
   187                 case gtQLocal: {
   192                 case gtQLocal: {
   188                     SendQuickConfig();
   193                     SendQuickConfig();
   189                     break;
   194                     break;
   190                 }
   195                 }
       
   196                 case gtSave:
   191                 case gtDemo: break;
   197                 case gtDemo: break;
   192                 case gtNet: {
   198                 case gtNet: {
   193                     SendNetConfig();
   199                     SendNetConfig();
   194                     break;
   200                     break;
   195                 }
   201                 }
   319     if (TeamCount == 5) return;
   325     if (TeamCount == 5) return;
   320     teams[TeamCount] = teamname;
   326     teams[TeamCount] = teamname;
   321     TeamCount++;
   327     TeamCount++;
   322 }
   328 }
   323 
   329 
   324 void HWGame::PlayDemo(const QString & demofilename)
   330 void HWGame::PlayDemo(const QString & demofilename, bool isSave)
   325 {
   331 {
   326     gameType = gtDemo;
   332     gameType = isSave ? gtSave : gtDemo;
   327     QFile demofile(demofilename);
   333     QFile demofile(demofilename);
   328     if (!demofile.open(QIODevice::ReadOnly))
   334     if (!demofile.open(QIODevice::ReadOnly))
   329     {
   335     {
   330         emit ErrorMessage(tr("Cannot open demofile %1").arg(demofilename));
   336         emit ErrorMessage(tr("Cannot open demofile %1").arg(demofilename));
   331         return ;
   337         return ;