Fix old team name not being removed after renaming team in frontend
authorWuzzy <almikes@aol.com>
Sat, 07 Oct 2017 20:07:21 +0200
changeset 12674 bc34fc75670e
parent 12673 308846e05154
child 12675 967990d958bc
Fix old team name not being removed after renaming team in frontend
ChangeLog.txt
QTfrontend/ui/page/pageeditteam.cpp
QTfrontend/ui/page/pageeditteam.h
--- a/ChangeLog.txt	Sat Oct 07 13:23:58 2017 -0400
+++ b/ChangeLog.txt	Sat Oct 07 20:07:21 2017 +0200
@@ -278,6 +278,7 @@
  * Fix caption of stats screen showing only one winner if multiple teams have won
  * Remove broken “Play again” button appearing in stats page after an online game
  * Weapons scheme editor: When leaving, it no longer flickers and the selection is not reset to Default
+ * Team editor: Fix old team being retained when renaming a team
 
 Content Creation:
  + Theme objects can now have more than 1 in-land rect specified. You can specify the amount in theme.cfg by adding another number (and ,) before the first rect
--- a/QTfrontend/ui/page/pageeditteam.cpp	Sat Oct 07 13:23:58 2017 -0400
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Sat Oct 07 20:07:21 2017 +0200
@@ -436,6 +436,7 @@
 {
     m_playerHash = playerHash;
     lazyLoad();
+    OldTeamName = name;
 
     // Mostly create a default team, with 2 important exceptions:
     HWTeam newTeam(name);
@@ -452,6 +453,7 @@
 {
     m_playerHash = playerHash;
     lazyLoad();
+    OldTeamName = name;
 
     HWTeam team(name);
     team.loadFromFile();
@@ -576,7 +578,8 @@
 
 HWTeam PageEditTeam::data()
 {
-    HWTeam team(TeamNameEdit->text());
+    HWTeam team(OldTeamName);
+    team.setName(TeamNameEdit->text());
     team.setDifficulty(CBTeamLvl->currentIndex());
 
     for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
--- a/QTfrontend/ui/page/pageeditteam.h	Sat Oct 07 13:23:58 2017 -0400
+++ b/QTfrontend/ui/page/pageeditteam.h	Sat Oct 07 20:07:21 2017 +0200
@@ -70,6 +70,7 @@
         HatButton * HHHats[HEDGEHOGS_PER_TEAM];
         HWTeam data();
         QString m_playerHash;
+        QString OldTeamName;
         KeyBinder * binder;
         bool m_loaded;