Clear hedgehog's gear Power value when switching. Should fix issue 446 (not tested, but looks obvious).
authorunc0rr
Sat, 27 Oct 2012 01:16:35 +0400
changeset 7835 a84936d1618a
parent 7834 3a65b70b1285
child 7836 69ece5fdec49
Clear hedgehog's gear Power value when switching. Should fix issue #446 (not tested, but looks obvious).
QTfrontend/ui/widget/teamselect.cpp
QTfrontend/ui/widget/teamselect.h
hedgewars/uTeams.pas
--- a/QTfrontend/ui/widget/teamselect.cpp	Sat Oct 27 00:53:23 2012 +0400
+++ b/QTfrontend/ui/widget/teamselect.cpp	Sat Oct 27 01:16:35 2012 +0400
@@ -283,9 +283,9 @@
     addTeam(team);
 }
 
-bool TeamSelWidget::isPlaying(HWTeam team) const
+bool TeamSelWidget::isPlaying(const HWTeam &team) const
 {
-    return std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team)!=curPlayingTeams.end();
+    return curPlayingTeams.contains(team);
 }
 
 QList<HWTeam> TeamSelWidget::getPlayingTeams() const
@@ -298,7 +298,7 @@
     return m_curNotPlayingTeams;
 }
 
-void TeamSelWidget::pre_changeTeamStatus(HWTeam team)
+void TeamSelWidget::pre_changeTeamStatus(const HWTeam & team)
 {
     //team.setColor(framePlaying->getNextColor());
     emit acceptRequested(team);
--- a/QTfrontend/ui/widget/teamselect.h	Sat Oct 27 00:53:23 2012 +0400
+++ b/QTfrontend/ui/widget/teamselect.h	Sat Oct 27 01:16:35 2012 +0400
@@ -43,7 +43,7 @@
         void setAcceptOuter(bool acceptOuter);
         void removeNetTeam(const HWTeam& team);
         void resetPlayingTeams(const QList<HWTeam>& teamslist);
-        bool isPlaying(HWTeam team) const;
+        bool isPlaying(const HWTeam &team) const;
         QList<HWTeam> getPlayingTeams() const;
         QList<HWTeam> getNotPlayingTeams() const;
         void setInteractivity(bool interactive);
@@ -57,14 +57,14 @@
 
     signals:
         void setEnabledGameStart(bool);
-        void teamWillPlay(HWTeam team);
+        void teamWillPlay(const HWTeam& team);
         void teamNotPlaying(const HWTeam& team);
         void hhogsNumChanged(const HWTeam&);
         void teamColorChanged(const HWTeam&);
-        void acceptRequested(HWTeam team);
+        void acceptRequested(const HWTeam& team);
 
     private slots:
-        void pre_changeTeamStatus(HWTeam);
+        void pre_changeTeamStatus(const HWTeam&);
         void hhNumChanged(const HWTeam& team);
         void proxyTeamColorChanged(const HWTeam& team);
 
--- a/hedgewars/uTeams.pas	Sat Oct 27 00:53:23 2012 +0400
+++ b/hedgewars/uTeams.pas	Sat Oct 27 01:16:35 2012 +0400
@@ -247,6 +247,7 @@
         Z:= cCurrHHZ;
         State:= gstHHDriven;
         Active:= true;
+        Power:= 0;
         LastDamage:= nil
         end;
     RemoveGearFromList(Gear);