tags 750729 + patch
thanks
OK, this fixes the lower and upper totals - running under valgrind
detects no problems at all.
Sorry about the breakage.
Cheers,
Olly
diff -Nru openyahtzee-1.9.1/debian/changelog openyahtzee-1.9.1/debian/changelog
--- openyahtzee-1.9.1/debian/changelog 2014-06-01 00:31:03.000000000 +1200
+++ openyahtzee-1.9.1/debian/changelog 2014-06-06 22:55:21.000000000 +1200
@@ -1,7 +1,16 @@
+openyahtzee (1.9.1-2.2) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Update wx3.0-compat.patch to fix use of undefined values when calculating
+ totals. (Closes: #750729)
+
+ -- Olly Betts <[email protected]> Fri, 06 Jun 2014 22:44:48 +1200
+
openyahtzee (1.9.1-2.1) unstable; urgency=low
* Non-maintainer upload.
* Update to use wxwidgets3.0 (new patch wx3.0-compat.patch)
+ (Closes: #749992)
-- Olly Betts <[email protected]> Sun, 01 Jun 2014 00:31:01 +1200
diff -Nru openyahtzee-1.9.1/debian/patches/wx3.0-compat.patch openyahtzee-1.9.1/debian/patches/wx3.0-compat.patch
--- openyahtzee-1.9.1/debian/patches/wx3.0-compat.patch 2014-06-01 00:30:51.000000000 +1200
+++ openyahtzee-1.9.1/debian/patches/wx3.0-compat.patch 2014-06-06 23:04:08.000000000 +1200
@@ -1,9 +1,9 @@
Description: wx3.0 compatibility
Author: Olly Betts <[email protected]>
-Last-Update: 2014-06-01
+Last-Update: 2014-06-06
---- openyahtzee-1.9.1.orig/src/simple_pie_plot.cpp
-+++ openyahtzee-1.9.1/src/simple_pie_plot.cpp
+--- a/src/simple_pie_plot.cpp
++++ b/src/simple_pie_plot.cpp
@@ -22,6 +22,7 @@
#include <memory>
#include <algorithm>
@@ -12,9 +12,9 @@
using namespace std;
using namespace simple_pie_plot;
---- openyahtzee-1.9.1.orig/src/MainFrame.cpp
-+++ openyahtzee-1.9.1/src/MainFrame.cpp
-@@ -465,7 +465,7 @@ void MainFrame::OnUndo(wxCommandEvent& e
+--- a/src/MainFrame.cpp
++++ b/src/MainFrame.cpp
+@@ -465,7 +465,7 @@
((wxButton*) FindWindow(ID_ROLL)) -> Enable(false);
// change the displayed roll counter
@@ -23,16 +23,19 @@
FindWindow(ID_ROLL)->SetLabel(caption);
//restore the 'keep' checkboxes
-@@ -491,7 +491,7 @@ void MainFrame::OnUndo(wxCommandEvent& e
+@@ -489,9 +489,9 @@
+ wxString tempstr;
+
tempstr = ((wxTextCtrl*) FindWindow(ID_YAHTZEEBONUSTEXT)) -> GetValue();
- tempstr.ToLong(&temp,10);
+- tempstr.ToLong(&temp,10);
++ if (!tempstr.ToLong(&temp,10)) temp = 0;
temp -= 100; //this line reduces the points given for the yahtzee bonus
- tempstr.Printf(wxT("%i"),temp);
+ tempstr.Printf(wxT("%li"),temp);
((wxTextCtrl*) FindWindow(ID_YAHTZEEBONUSTEXT)) -> SetValue(tempstr);
}
-@@ -614,7 +614,7 @@ void MainFrame::OnRollButton ()
+@@ -614,7 +614,7 @@
--m_rolls;
// change the displayed roll counter
@@ -41,7 +44,7 @@
FindWindow(ID_ROLL)->SetLabel(caption);
#ifndef DEBUG
-@@ -696,7 +696,7 @@ void MainFrame::OnUpperButtons (wxComman
+@@ -696,7 +696,7 @@
break;
}
@@ -50,7 +53,7 @@
wxTextCtrl *text_ctrl = dynamic_cast<wxTextCtrl*>(FindWindow(event.GetId() - ID_ACES + ID_ACESTEXT));
text_ctrl->SetValue(out);
text_ctrl->SetBackgroundColour(*wxWHITE);
-@@ -717,7 +717,7 @@ void MainFrame::On3ofakindButton(wxComma
+@@ -717,7 +717,7 @@
YahtzeeBonus();
wxString out;
@@ -59,7 +62,7 @@
wxTextCtrl *text_ctrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_THREEOFAKINDTEXT));
text_ctrl->SetValue(out);
text_ctrl->SetBackgroundColour(*wxWHITE);
-@@ -738,7 +738,7 @@ void MainFrame::On4ofakindButton(wxComma
+@@ -738,7 +738,7 @@
YahtzeeBonus();
wxString out;
@@ -68,7 +71,7 @@
wxTextCtrl *text_ctrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_FOUROFAKINDTEXT));
text_ctrl->SetValue(out);
text_ctrl->SetBackgroundColour(*wxWHITE);
-@@ -760,7 +760,7 @@ void MainFrame::OnFullHouseButton(wxComm
+@@ -760,7 +760,7 @@
YahtzeeBonus();
@@ -77,7 +80,7 @@
wxTextCtrl *text_ctrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_FULLHOUSETEXT));
text_ctrl->SetValue(out);
text_ctrl->SetBackgroundColour(*wxWHITE);
-@@ -782,7 +782,7 @@ void MainFrame::OnSmallSequenceButton(wx
+@@ -782,7 +782,7 @@
YahtzeeBonus();
@@ -86,7 +89,7 @@
wxTextCtrl *text_ctrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_SMALLSEQUENCETEXT));
text_ctrl->SetValue(out);
text_ctrl->SetBackgroundColour(*wxWHITE);
-@@ -804,7 +804,7 @@ void MainFrame::OnLargeSequenceButton(wx
+@@ -804,7 +804,7 @@
YahtzeeBonus();
@@ -95,7 +98,7 @@
wxTextCtrl *text_ctrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_LARGESEQUENCETEXT));
text_ctrl->SetValue(out);
text_ctrl->SetBackgroundColour(*wxWHITE);
-@@ -826,7 +826,7 @@ void MainFrame::OnYahtzeeButton(wxComman
+@@ -826,7 +826,7 @@
return;
if (m_score_dice.IsYahtzee()) m_yahtzee = true;
@@ -104,7 +107,7 @@
wxTextCtrl *text_ctrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_YAHTZEETEXT));
text_ctrl->SetValue(out);
text_ctrl->SetBackgroundColour(*wxWHITE);
-@@ -847,7 +847,7 @@ void MainFrame::OnChanceButton (wxComman
+@@ -847,7 +847,7 @@
YahtzeeBonus();
@@ -113,17 +116,26 @@
wxTextCtrl *text_ctrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_CHANCETEXT));
text_ctrl->SetValue(out);
text_ctrl->SetBackgroundColour(*wxWHITE);
-@@ -920,7 +920,7 @@ void MainFrame::YahtzeeBonus()
+@@ -918,9 +918,9 @@
+ return;
+ if (m_score_dice.IsYahtzee()) {
tempstr = ((wxTextCtrl*) FindWindow(ID_YAHTZEEBONUSTEXT)) -> GetValue();
- tempstr.ToLong(&temp,10);
+- tempstr.ToLong(&temp,10);
++ if (!tempstr.ToLong(&temp,10)) temp = 0;
temp += 100;
- tempstr.Printf(wxT("%i"),temp);
+ tempstr.Printf(wxT("%li"),temp);
((wxTextCtrl*) FindWindow(ID_YAHTZEEBONUSTEXT)) -> SetValue(tempstr);
m_yahtzeebonus = true;
}
-@@ -962,7 +962,7 @@ void MainFrame::EndofGame()
- upperscore +=temp;
+@@ -958,11 +958,11 @@
+
+ for (int i = ID_ACESTEXT; i<=ID_SIXESTEXT; i++){
+ tempstr = ((wxTextCtrl*) FindWindow(i)) -> GetValue();
+- tempstr.ToLong(&temp,10);
+- upperscore +=temp;
++ if (tempstr.ToLong(&temp,10))
++ upperscore +=temp;
}
- tempstr.Printf(wxT("%i"),upperscore);
@@ -131,7 +143,7 @@
((wxTextCtrl*) FindWindow(ID_UPPERSECTIONTOTAL)) -> SetValue(tempstr);
//check for bonus
-@@ -972,7 +972,7 @@ void MainFrame::EndofGame()
+@@ -972,25 +972,25 @@
} else
((wxTextCtrl*) FindWindow(ID_BONUS)) -> SetValue(wxT("0"));
@@ -140,8 +152,12 @@
((wxTextCtrl*) FindWindow(ID_UPPERTOTAL)) -> SetValue(tempstr);
//calculate total on lower section
-@@ -982,15 +982,15 @@ void MainFrame::EndofGame()
- lowerscore +=temp;
+ for (int i = ID_THREEOFAKINDTEXT; i<=ID_YAHTZEEBONUSTEXT; i++) {
+ tempstr = ((wxTextCtrl*) FindWindow(i)) -> GetValue();
+- tempstr.ToLong(&temp,10);
+- lowerscore +=temp;
++ if (tempstr.ToLong(&temp,10))
++ lowerscore +=temp;
}
- tempstr.Printf(wxT("%i"),lowerscore);
@@ -159,8 +175,14 @@
wxMessageBox(tempstr, wxT("Game Ended"), wxOK | wxICON_INFORMATION, this);
m_stats->game_finished(lowerscore+upperscore);
-@@ -1084,7 +1084,7 @@ void MainFrame::CalculateSubTotal()
- upperscore +=temp;
+@@ -1080,11 +1080,11 @@
+
+ for (int i = ID_ACESTEXT; i<=ID_SIXESTEXT; i++){
+ tempstr = ((wxTextCtrl*) FindWindow(i)) -> GetValue();
+- tempstr.ToLong(&temp,10);
+- upperscore +=temp;
++ if (tempstr.ToLong(&temp,10))
++ upperscore +=temp;
}
- tempstr.Printf(wxT("%i"),upperscore);
@@ -168,8 +190,14 @@
((wxTextCtrl*) FindWindow(ID_UPPERSECTIONTOTAL)) -> SetValue(tempstr);
if (upperscore >= 63) {
((wxTextCtrl*) FindWindow(ID_BONUS))->SetValue(wxT("35"));
-@@ -1099,7 +1099,7 @@ void MainFrame::CalculateSubTotal()
- lowerscore +=temp;
+@@ -1095,11 +1095,11 @@
+
+ for (int i = ID_THREEOFAKINDTEXT; i<=ID_YAHTZEEBONUSTEXT; i++) {
+ tempstr = ((wxTextCtrl*) FindWindow(i)) -> GetValue();
+- tempstr.ToLong(&temp,10);
+- lowerscore +=temp;
++ if (tempstr.ToLong(&temp,10))
++ lowerscore +=temp;
}
- tempstr.Printf(wxT("%i"),lowerscore);
@@ -177,7 +205,7 @@
((wxTextCtrl*) FindWindow(ID_LOWERTOTAL)) -> SetValue(tempstr);
}
-@@ -1193,7 +1193,7 @@ void MainFrame::Relayout()
+@@ -1193,7 +1193,7 @@
// if there are rolls left we should display the count of them
if (roll_button_enabled) {
@@ -186,7 +214,7 @@
FindWindow(ID_ROLL)->SetLabel(caption);
}
-@@ -1276,43 +1276,43 @@ void MainFrameEvtHandler::OnScoreMouseEn
+@@ -1276,43 +1276,43 @@
text_control = ((wxTextCtrl*)m_main_frame->FindWindow(id-ID_ACES+ID_ACESTEXT));
switch (id) {
case ID_ACES: