Randomize forts and graves in new teams
authorWuzzy <almikes@aol.com>
Thu, 13 Apr 2017 06:25:41 +0200
changeset 12242 09010333c947
parent 12241 0b5aa545e058
child 12243 8a6a40f2e3dc
Randomize forts and graves in new teams
QTfrontend/hwform.cpp
QTfrontend/ui/page/pageeditteam.cpp
QTfrontend/util/namegen.h
--- a/QTfrontend/hwform.cpp	Thu Apr 13 05:44:23 2017 +0200
+++ b/QTfrontend/hwform.cpp	Thu Apr 13 06:25:41 2017 +0200
@@ -473,14 +473,19 @@
         }
 
         HWTeam defaultTeam(teamName);
+        // Randomize fort and grave for greater variety by default
+        defaultTeam.setGrave(HWNamegen::getRandomGrave());
+        defaultTeam.setFort(HWNamegen::getRandomFort());
         defaultTeam.saveToFile();
         teamslist.push_back(teamName);
 
-        // Team 2, Team 3, Team 4
+        // Add 3 additional teams to allow local multiplayer instantly
         for(int i=2; i<=4; i++)
         {
             teamName = tr("Team %1").arg(i);
             HWTeam numberTeam(teamName);
+            numberTeam.setGrave(HWNamegen::getRandomGrave());
+            numberTeam.setFort(HWNamegen::getRandomFort());
             numberTeam.saveToFile();
             teamslist.push_back(teamName);
         }
--- a/QTfrontend/ui/page/pageeditteam.cpp	Thu Apr 13 05:44:23 2017 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Thu Apr 13 06:25:41 2017 +0200
@@ -347,7 +347,12 @@
     m_playerHash = playerHash;
     lazyLoad();
 
+    // Mostly create a default team, with 2 important exceptions:
     HWTeam newTeam(name);
+    // Randomize grave to make it less likely that default teams have equal graves (important for resurrector)
+    newTeam.setGrave(HWNamegen::getRandomGrave());
+    // Randomize fort for greater variety in fort mode with default teams
+    newTeam.setFort(HWNamegen::getRandomFort());
     loadTeam(newTeam);
 }
 
--- a/QTfrontend/util/namegen.h	Thu Apr 13 05:44:23 2017 +0200
+++ b/QTfrontend/util/namegen.h	Thu Apr 13 06:25:41 2017 +0200
@@ -31,6 +31,10 @@
 
         static void teamRandomName(HWTeam & team, const int HedgehogNumber);
         static void teamRandomNames(HWTeam & team, const bool changeteamname);
+        static QString getRandomGrave();
+        static QString getRandomFort();
+        static QString getRandomFlag();
+        static QString getRandomVoice();
 
     private:
         HWNamegen();
@@ -43,10 +47,6 @@
         static QStringList dictContents(const QString filename);
         static QStringList dictsForHat(const QString hatname);
 
-        static QString getRandomGrave();
-        static QString getRandomFort();
-        static QString getRandomFlag();
-        static QString getRandomVoice();
         static void teamRandomName(HWTeam & team, const int HedgehogNumber, const QStringList & dict);
 };