{
int ticks = m_Resources[type].size();
+ int latest = 0;
+
+ if (ticks > 0)
+ latest = m_Resources[type][ticks - 1];
+
for (int i = ticks; i <= tick; ++i)
- m_Resources[type].push_back(number);
+ m_Resources[type].push_back(latest);
m_Resources[type][tick] += number;
}
int lost = totcapped * part;
cerr << (*j)->name() << " gaining " << lost << " " << res << " since it's " << part * 100 << "% of the whole score, and it had : " << fl1 << " score last tick.. compared to fleet total of: " << score(0) << endl;
- (*j)->setResource(res, (*j)->resource(res, tick - 1) + lost, tick);
+ (*j)->addResource(res, lost, tick);
}
}
}
m_UnitsLostSurvivedView[(*i)]->setText(QString("%1").arg(after - before));
}
+ int lost;
+ int before;
+ int after;
+
+ before = m_Fleet->resource(tr("metal").latin1(),m_iMinTick);
+ after = m_Fleet->resource(tr("metal").latin1(),m_iMaxTick);
+ lost = after - before;
+ 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;
+ 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;
+ m_ResourceView->setLines(tr("eonium"),lost);
+
+ before = m_Fleet->resource(tr("uninit").latin1(),m_iMinTick);
+ after = m_Fleet->resource(tr("uninit").latin1(),m_iMaxTick);
+ lost = after - before;
+ m_ResourceView->setLines(tr("uninit"),lost);
+
+ before = m_Fleet->score(m_iMinTick);
+ after = m_Fleet->score(m_iMaxTick);
+ lost = after - before;
+ m_ResourceView->setLines(tr("score"),after);
+ m_ResourceView->setLines(tr("lost"),lost);
+
+
Planet* pl;
if ((pl = dynamic_cast<Planet*>(m_Fleet)))
{
- int lost;
- int before;
- int after;
before = pl->roids(tr("metal").latin1(),m_iMinTick);
after = pl->roids(tr("metal").latin1(),m_iMaxTick);
<property name="geometry">
<rect>
<x>0</x>
- <y>11</y>
+ <y>0</y>
<width>222</width>
<height>105</height>
</rect>
</widget>
<widget class="QLineEdit" row="1" column="3">
<property name="name">
- <cstring>EoniumLine</cstring>
+ <cstring>EoniumEdit</cstring>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</widget>
<widget class="QLineEdit" row="1" column="1">
<property name="name">
- <cstring>CrystalLine</cstring>
+ <cstring>CrystalEdit</cstring>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</widget>
<widget class="QLineEdit" row="1" column="2">
<property name="name">
- <cstring>UninitLine</cstring>
+ <cstring>UninitEdit</cstring>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</widget>
<widget class="QLineEdit" row="1" column="0">
<property name="name">
- <cstring>MetalLine</cstring>
+ <cstring>MetalEdit</cstring>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</widget>
</grid>
</widget>
+<connections>
+</connections>
<includes>
<include location="local" impldecl="in implementation">resourceview.ui.h</include>
</includes>
+<slots>
+ <slot>setLines( QString type, int i )</slot>
+</slots>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>
** a constructor, and a destroy() slot in place of a destructor.
*****************************************************************************/
-//test
\ No newline at end of file
+//test
+
+void ResourceView::setLines( QString type, int i )
+{
+ if (type == tr("metal"))
+ MetalEdit->setText(QString("%1").arg(i));
+ else if (type == tr("crystal"))
+ CrystalEdit->setText(QString("%1").arg(i));
+ else if (type == tr("eonium"))
+ EoniumEdit->setText(QString("%1").arg(i));
+ else if (type == tr("uninit"))
+ UninitEdit->setText(QString("%1").arg(i));
+ else if (type == tr("score"))
+ ScoreEdit->setText(QString("%1").arg(i));
+ else if (type == tr("lost"))
+ ScoreLostEdit->setText(QString("%1").arg(i));
+}
\ No newline at end of file