QTfrontend/hwform.cpp
changeset 12638 a791a08062d6
parent 12310 d3a52e51efd4
child 12639 91e55ce06ffc
equal deleted inserted replaced
12637:888032b2fda4 12638:a791a08062d6
   459 
   459 
   460     if(teamslist.empty())
   460     if(teamslist.empty())
   461     {
   461     {
   462         QString currentNickName = config->value("net/nick",tr("Guest")+QString("%1").arg(rand())).toString().toUtf8();
   462         QString currentNickName = config->value("net/nick",tr("Guest")+QString("%1").arg(rand())).toString().toUtf8();
   463         QString teamName;
   463         QString teamName;
       
   464         int firstHumanTeam = 1;
       
   465         int lastHumanTeam = 5;
   464 
   466 
   465         // Default team
   467         // Default team
   466         if (currentNickName.isEmpty())
   468         if (currentNickName.isEmpty())
   467         {
   469         {
   468             teamName = tr("Team 1");
   470             teamName = tr("Team 1");
       
   471             firstHumanTeam++;
   469         }
   472         }
   470         else
   473         else
   471         {
   474         {
   472             teamName = tr("%1's Team").arg(currentNickName);
   475             teamName = tr("%1's Team").arg(currentNickName);
       
   476             lastHumanTeam--;
   473         }
   477         }
   474 
   478 
   475         HWTeam defaultTeam(teamName);
   479         HWTeam defaultTeam(teamName);
   476         // Randomize fort and grave for greater variety by default.
   480         // Randomize fort and grave for greater variety by default.
   477         // But we exclude DLC graves and forts to not have desyncing teams by default
   481         // But we exclude DLC graves and forts to not have desyncing teams by default
   479         HWNamegen::teamRandomGrave(defaultTeam, false);
   483         HWNamegen::teamRandomGrave(defaultTeam, false);
   480         HWNamegen::teamRandomFort(defaultTeam, false);
   484         HWNamegen::teamRandomFort(defaultTeam, false);
   481         defaultTeam.saveToFile();
   485         defaultTeam.saveToFile();
   482         teamslist.push_back(teamName);
   486         teamslist.push_back(teamName);
   483 
   487 
   484         // Add 3 additional teams to allow local multiplayer instantly
   488         // Add additional default teams
   485         for(int i=2; i<=4; i++)
   489 
   486         {
   490         // 4 human teams to allow local multiplayer instantly
       
   491         for(int i=firstHumanTeam; i<=lastHumanTeam; i++)
       
   492         {
       
   493             //: Default team name
   487             teamName = tr("Team %1").arg(i);
   494             teamName = tr("Team %1").arg(i);
   488             HWTeam numberTeam(teamName);
   495             HWTeam numberTeam(teamName);
   489             HWNamegen::teamRandomGrave(numberTeam, false);
   496             HWNamegen::teamRandomGrave(numberTeam, false);
   490             HWNamegen::teamRandomFort(numberTeam, false);
   497             HWNamegen::teamRandomFort(numberTeam, false);
       
   498             numberTeam.saveToFile();
       
   499             teamslist.push_back(teamName);
       
   500         }
       
   501         // Add default CPU teams for each level
       
   502         for(int i=1; i<=5; i++)
       
   503         {
       
   504             //: Default computer team name
       
   505             teamName = tr("Computer %1").arg(i);
       
   506             HWTeam numberTeam(teamName);
       
   507             HWNamegen::teamRandomGrave(numberTeam, false);
       
   508             HWNamegen::teamRandomFort(numberTeam, false);
       
   509             numberTeam.setDifficulty(6-i);
   491             numberTeam.saveToFile();
   510             numberTeam.saveToFile();
   492             teamslist.push_back(teamName);
   511             teamslist.push_back(teamName);
   493         }
   512         }
   494     }
   513     }
   495 
   514