Create 5 human teams + 5 AI teams on first start
authorWuzzy <almikes@aol.com>
Mon, 02 Oct 2017 20:59:40 +0200
changeset 12633 a791a08062d6
parent 12632 888032b2fda4
child 12634 91e55ce06ffc
Create 5 human teams + 5 AI teams on first start
ChangeLog.txt
QTfrontend/hwform.cpp
--- a/ChangeLog.txt	Mon Oct 02 18:12:23 2017 +0200
+++ b/ChangeLog.txt	Mon Oct 02 20:59:40 2017 +0200
@@ -253,7 +253,7 @@
  + Additional button for just randomizing theme that will not change your selected map
  + Randomizing map/theme in online-mode will not include DLC-content
  + New teams start with a random grave and fort
- + Hedgewars creates 4 teams instead of 1 on its first launch
+ + Hedgewars creates 5 human teams and 5 computer teams on its first launch
  + Allow to randomize hog names, hats, team name, flag, grave, voice and fort separately
  + “Random team” button is now able to randomly select from all available hats
  * Fix flag being selectable for computer players although it had no effect
--- a/QTfrontend/hwform.cpp	Mon Oct 02 18:12:23 2017 +0200
+++ b/QTfrontend/hwform.cpp	Mon Oct 02 20:59:40 2017 +0200
@@ -461,15 +461,19 @@
     {
         QString currentNickName = config->value("net/nick",tr("Guest")+QString("%1").arg(rand())).toString().toUtf8();
         QString teamName;
+        int firstHumanTeam = 1;
+        int lastHumanTeam = 5;
 
         // Default team
         if (currentNickName.isEmpty())
         {
             teamName = tr("Team 1");
+            firstHumanTeam++;
         }
         else
         {
             teamName = tr("%1's Team").arg(currentNickName);
+            lastHumanTeam--;
         }
 
         HWTeam defaultTeam(teamName);
@@ -481,9 +485,12 @@
         defaultTeam.saveToFile();
         teamslist.push_back(teamName);
 
-        // Add 3 additional teams to allow local multiplayer instantly
-        for(int i=2; i<=4; i++)
+        // Add additional default teams
+
+        // 4 human teams to allow local multiplayer instantly
+        for(int i=firstHumanTeam; i<=lastHumanTeam; i++)
         {
+            //: Default team name
             teamName = tr("Team %1").arg(i);
             HWTeam numberTeam(teamName);
             HWNamegen::teamRandomGrave(numberTeam, false);
@@ -491,6 +498,18 @@
             numberTeam.saveToFile();
             teamslist.push_back(teamName);
         }
+        // Add default CPU teams for each level
+        for(int i=1; i<=5; i++)
+        {
+            //: Default computer team name
+            teamName = tr("Computer %1").arg(i);
+            HWTeam numberTeam(teamName);
+            HWNamegen::teamRandomGrave(numberTeam, false);
+            HWNamegen::teamRandomFort(numberTeam, false);
+            numberTeam.setDifficulty(6-i);
+            numberTeam.saveToFile();
+            teamslist.push_back(teamName);
+        }
     }
 
     ui.pageOptions->CBTeamName->clear();