m_bHome = false;
}
+ m_Fleet->printFleet();
m_bFriendly = friendly;
//m_ChangesMapper = new QSignalMapper(this);
m_UnitsLayout = new QGridLayout(m_MainLayout, rows, 6);
buildUnitTable();
//QSpacerItem* space = new QSpacerItem(1, 1);
- fillTable();
+
m_MainLayout->addStretch(10);
{
m_RoidsEditView = new RoidsEditView(this);
m_MainLayout->addWidget(m_RoidsEditView);
+ connect(m_RoidsEditView, SIGNAL(changed(const QString&, int)), SLOT(slotRoidsChanged(const QString&, int)));
}
m_ResourceView = new ResourceView(this);
m_MainLayout->addWidget(m_ResourceView);
-
+ fillTable();
}
FleetView::~FleetView(){
{
m_Fleet = new Fleet(*fleet);
}
+ //m_Fleet->printFleet();
fillTable();
}
{
m_UnitsEdit[(*i)]->setText(QString("%1").arg(m_Fleet->fleet(i->latin1(), 0)));
}
+ Planet* pl;
+ if ((pl = dynamic_cast<Planet*>(m_Fleet)) && m_bHome)
+ {
+ m_RoidsEditView->setValue(tr("score"),pl->planetScore());
+ m_RoidsEditView->setValue(tr("metal"),pl->roids(tr("metal").latin1()));
+ m_RoidsEditView->setValue(tr("crystal"),pl->roids(tr("crystal").latin1()));
+ m_RoidsEditView->setValue(tr("eonium"),pl->roids(tr("eonium").latin1()));
+ m_RoidsEditView->setValue(tr("uninit"),pl->roids(tr("uninit").latin1()));
+ }
}
+/////////////////////////////////////////////////////////////////////
+//
+void FleetView::slotRoidsChanged(const QString& type, int value)
+{
+ Planet* pl;
+ if ((pl = dynamic_cast<Planet*>(m_Fleet)))
+ {
+ if (type == tr("score"))
+ pl->setPlanetScore(value);
+ else
+ {
+ pl->setRoids(type.latin1(), value);
+ }
+ emit fleetChanged(pl);
+ }
+}
+
+/////////////////////////////////////////////////////////////////////
+//
+void FleetView::slotViewTickRange(int min = -1, int max = -1)
+{
+ if (min > -1)
+ m_iMinTick = min;
+ if (max > -1)
+ m_iMaxTick = max;
+ for(vector<QString>::iterator i = m_Names.begin(); i != m_Names.end(); ++i)
+ {
+ int before = m_Fleet->fleet(i->latin1(), m_iMinTick);
+ int after = m_Fleet->fleet(i->latin1(), m_iMaxTick);
+ m_UnitsLostSurvivedView[(*i)]->setText(QString("%1").arg(after - before));
+ }
+
+ 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);
+ 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);
+ float cost = (before - after) / float(init) / 1000;
+ m_ResourceView->setLines(tr("cost"),cost);
+
+
+
+ Planet* pl;
+ if ((pl = dynamic_cast<Planet*>(m_Fleet)))
+ {
+
+ before = pl->roids(tr("metal").latin1(),m_iMinTick);
+ after = pl->roids(tr("metal").latin1(),m_iMaxTick);
+ lost = after - before;
+ m_RoidsEditView->slotSetLost(tr("metal"),lost);
+
+ before = pl->roids(tr("crystal").latin1(),m_iMinTick);
+ after = pl->roids(tr("crystal").latin1(),m_iMaxTick);
+ lost = after - before;
+ m_RoidsEditView->slotSetLost(tr("crystal"),lost);
+
+ before = pl->roids(tr("eonium").latin1(),m_iMinTick);
+ after = pl->roids(tr("eonium").latin1(),m_iMaxTick);
+ lost = after - before;
+ m_RoidsEditView->slotSetLost(tr("eonium"),lost);
+
+ before = pl->roids(tr("uninit").latin1(),m_iMinTick);
+ after = pl->roids(tr("uninit").latin1(),m_iMaxTick);
+ lost = after - before;
+ m_RoidsEditView->slotSetLost(tr("uninit"),lost);
+ }
+}