fix non changing graph title and sendstat health
authorPeriklis Ntanasis <pntanasis@gmail.com>
Sun, 09 Jun 2013 01:18:58 +0300
changeset 9177 d5e98b81e135
parent 9176 c21c88dca14c
child 9178 c0902317c823
fix non changing graph title and sendstat health
QTfrontend/ui/page/pagegamestats.cpp
QTfrontend/ui/page/pagegamestats.h
hedgewars/uScript.pas
--- a/QTfrontend/ui/page/pagegamestats.cpp	Sat Jun 08 23:54:44 2013 +0300
+++ b/QTfrontend/ui/page/pagegamestats.cpp	Sun Jun 09 01:18:58 2013 +0300
@@ -40,6 +40,7 @@
 
 QLayout * PageGameStats::bodyLayoutDefinition()
 {
+	defaultGraphTitle = true;	
     QGridLayout * pageLayout = new QGridLayout();
     pageLayout->setSpacing(20);
     pageLayout->setColumnStretch(0, 1);
@@ -159,12 +160,16 @@
 {
 	graphic->show();
 	labelGraphTitle-> show();
+	if(defaultGraphTitle) {
+		labelGraphTitle->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>");
+	} else {
+		defaultGraphTitle = true;
+	}
 	// if not health data sent
 	if(healthPoints.size() == 0) {
 		labelGraphTitle->hide();
 		graphic->hide();
 	} else {
-		labelGraphTitle->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>");
 		QGraphicsScene * scene = new QGraphicsScene();
 
 		QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin();
@@ -232,6 +237,7 @@
         case 'g' :
         {
 			// TODO: change default picture or add change pic capability
+			defaultGraphTitle = false;
 			labelGraphTitle->setText("<br><h1><img src=\":/res/StatsR.png\"> " + info + "</h1>");
             break;
         }
--- a/QTfrontend/ui/page/pagegamestats.h	Sat Jun 08 23:54:44 2013 +0300
+++ b/QTfrontend/ui/page/pagegamestats.h	Sun Jun 09 01:18:58 2013 +0300
@@ -68,6 +68,7 @@
         QMap<quint32, QVector<quint32> > healthPoints;
         unsigned int playerPosition;
         quint32 lastColor;
+        bool defaultGraphTitle;
 
     protected:
         QLayout * bodyLayoutDefinition();
--- a/hedgewars/uScript.pas	Sat Jun 08 23:54:44 2013 +0300
+++ b/hedgewars/uScript.pas	Sun Jun 09 01:18:58 2013 +0300
@@ -1294,7 +1294,7 @@
 	//TODO print better error messages
 	statInfo := TStatInfoType(GetEnumValue(TypeInfo(TStatInfoType),lua_tostring(L, 1)));
 	if (lua_gettop(L) <> 2) and ((statInfo <> siPlayerKills) 
-			or (statInfo <> siClanHealth)) then
+			and (statInfo <> siClanHealth)) then
         begin
         LuaError('Lua: Wrong number of parameters passed to SendStat!');
         end