]> ruin.nu Git - hbs.git/commitdiff
added functionallity to show the cost for each roid.
authorMichael Andreen <harv@ruin.nu>
Fri, 12 Apr 2002 23:38:40 +0000 (23:38 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 12 Apr 2002 23:38:40 +0000 (23:38 +0000)
bs/fleetview.cpp
bs/ui/resourceview.ui
bs/ui/resourceview.ui.h

index 7c6633bef71c68c4d5785a4f0465db81f5dc4696..da0714431b9573e89e817be9e4943379a3787ce8 100644 (file)
@@ -239,20 +239,25 @@ void FleetView::slotViewTickRange(int min = -1, int max = -1)
        int lost;
        int before;
        int after;
+       
+       int init = 0;
 
        before = m_Fleet->resource(tr("metal").latin1(),m_iMinTick);
        after = m_Fleet->resource(tr("metal").latin1(),m_iMaxTick);
        lost = after - before;
+       init += lost;
        m_ResourceView->setLines(tr("metal"),lost);
 
        before = m_Fleet->resource(tr("crystal").latin1(),m_iMinTick);
        after = m_Fleet->resource(tr("crystal").latin1(),m_iMaxTick);
        lost = after - before;
+       init += lost;
        m_ResourceView->setLines(tr("crystal"),lost);
 
        before = m_Fleet->resource(tr("eonium").latin1(),m_iMinTick);
        after = m_Fleet->resource(tr("eonium").latin1(),m_iMaxTick);
        lost = after - before;
+       init += lost;
        m_ResourceView->setLines(tr("eonium"),lost);
 
        before = m_Fleet->resource(tr("uninit").latin1(),m_iMinTick);
@@ -265,6 +270,9 @@ void FleetView::slotViewTickRange(int min = -1, int max = -1)
        lost = after - before;
        m_ResourceView->setLines(tr("score"),after);
        m_ResourceView->setLines(tr("lost"),lost);
+       float cost =  (before - after) / float(init) / 1000;
+       m_ResourceView->setLines(tr("cost"),cost);
+       
 
 
        Planet* pl;
index 43438bd0f2cc5826f3a1d624c586ebf7a9bfc455..376a60a53f4d11f126615f961445b50fc3794107 100644 (file)
@@ -10,7 +10,7 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>222</width>
+            <width>551</width>
             <height>105</height>
         </rect>
     </property>
@@ -44,7 +44,7 @@
         <property name="spacing">
             <number>6</number>
         </property>
-        <widget class="QLabel" row="0" column="1">
+        <widget class="QLabel" row="0" column="2" rowspan="1" colspan="2">
             <property name="name">
                 <cstring>crystalLabel</cstring>
             </property>
@@ -52,7 +52,7 @@
                 <string>Crystal</string>
             </property>
         </widget>
-        <widget class="QLabel" row="0" column="2">
+        <widget class="QLabel" row="0" column="4" rowspan="1" colspan="2">
             <property name="name">
                 <cstring>eoniumLabel</cstring>
             </property>
@@ -60,7 +60,7 @@
                 <string>Eonium</string>
             </property>
         </widget>
-        <widget class="QLineEdit" row="1" column="3">
+        <widget class="QLineEdit" row="1" column="6" rowspan="1" colspan="2">
             <property name="name">
                 <cstring>EoniumEdit</cstring>
             </property>
@@ -71,7 +71,7 @@
                 <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLineEdit" row="1" column="1">
+        <widget class="QLineEdit" row="1" column="2" rowspan="1" colspan="2">
             <property name="name">
                 <cstring>CrystalEdit</cstring>
             </property>
@@ -82,7 +82,7 @@
                 <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLabel" row="0" column="0">
+        <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
             <property name="name">
                 <cstring>metalLabel</cstring>
             </property>
@@ -90,7 +90,7 @@
                 <string>Metal</string>
             </property>
         </widget>
-        <widget class="QLineEdit" row="1" column="2">
+        <widget class="QLineEdit" row="1" column="4" rowspan="1" colspan="2">
             <property name="name">
                 <cstring>UninitEdit</cstring>
             </property>
                 <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLineEdit" row="2" column="1">
+        <widget class="QLineEdit" row="1" column="0" rowspan="1" colspan="2">
             <property name="name">
-                <cstring>ScoreEdit</cstring>
+                <cstring>MetalEdit</cstring>
             </property>
             <property name="focusPolicy">
                 <enum>NoFocus</enum>
                 <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLineEdit" row="1" column="0">
+        <widget class="QLabel" row="2" column="0">
             <property name="name">
-                <cstring>MetalEdit</cstring>
+                <cstring>ScoreLabel</cstring>
+            </property>
+            <property name="text">
+                <string>Score:</string>
+            </property>
+        </widget>
+        <widget class="QLineEdit" row="2" column="1" rowspan="1" colspan="2">
+            <property name="name">
+                <cstring>ScoreEdit</cstring>
             </property>
             <property name="focusPolicy">
                 <enum>NoFocus</enum>
                 <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLabel" row="0" column="3">
+        <widget class="QLabel" row="2" column="3">
+            <property name="name">
+                <cstring>ScoreLostLabel</cstring>
+            </property>
+            <property name="text">
+                <string>Lost</string>
+            </property>
+        </widget>
+        <widget class="QLabel" row="0" column="6" rowspan="1" colspan="2">
             <property name="name">
                 <cstring>uninitLabel</cstring>
             </property>
                 <string>Uninit</string>
             </property>
         </widget>
-        <widget class="QLabel" row="2" column="0">
+        <widget class="QLineEdit" row="2" column="4">
             <property name="name">
-                <cstring>ScoreLabel</cstring>
+                <cstring>ScoreLostEdit</cstring>
             </property>
-            <property name="text">
-                <string>Score:</string>
+            <property name="focusPolicy">
+                <enum>NoFocus</enum>
+            </property>
+            <property name="readOnly">
+                <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLabel" row="2" column="2">
+        <widget class="QLabel" row="2" column="5" rowspan="1" colspan="2">
             <property name="name">
-                <cstring>ScoreLostLabel</cstring>
+                <cstring>CostLabel</cstring>
             </property>
             <property name="text">
-                <string>Lost</string>
+                <string>Cost</string>
+            </property>
+            <property name="toolTip" stdset="0">
+                <string>The cost in k score / init roid</string>
             </property>
         </widget>
-        <widget class="QLineEdit" row="2" column="3">
+        <widget class="QLineEdit" row="2" column="7">
             <property name="name">
-                <cstring>ScoreLostEdit</cstring>
+                <cstring>CostEdit</cstring>
             </property>
             <property name="focusPolicy">
                 <enum>NoFocus</enum>
     <include location="local" impldecl="in implementation">resourceview.ui.h</include>
 </includes>
 <slots>
-    <slot>setLines( QString type, int i )</slot>
+    <slot>setLines( QString type, float i )</slot>
 </slots>
 <pixmapinproject/>
 <layoutdefaults spacing="6" margin="11"/>
index 5e8f9ded76bc97f220a97c1e6f94909e08763aca..485c4e59866db7a75ca779650ddabf2657578441 100644 (file)
@@ -8,7 +8,7 @@
 
 //test
 
-void ResourceView::setLines( QString type, int i )
+void ResourceView::setLines( QString type, float i )
 {
     if (type == tr("metal"))
        MetalEdit->setText(QString("%1").arg(i));
@@ -22,4 +22,6 @@ void ResourceView::setLines( QString type, int i )
        ScoreEdit->setText(QString("%1").arg(i));
     else if (type == tr("lost"))
        ScoreLostEdit->setText(QString("%1").arg(i));
+     else if (type == tr("cost"))
+       CostEdit->setText(QString("%1").arg(i));
 }
\ No newline at end of file