FleetView::FleetView(const Fleet* fleet, bool friendly, QWidget *parent, const char *name ) : QWidget(parent,name)
{
+ m_iMinTick = 0;
+ m_iMaxTick = 0;
+ m_iResultMode = 0;
+
m_Modified = false;
const Planet* planet = 0;
if((planet = dynamic_cast<const Planet*>(fleet)))
m_bHome = false;
}
+ m_Fleet->printFleet();
m_bFriendly = friendly;
//m_ChangesMapper = new QSignalMapper(this);
}
m_ResourceView = new ResourceView(this);
m_MainLayout->addWidget(m_ResourceView);
- fillTable();
+ fillTable();
}
FleetView::~FleetView(){
{
m_Fleet = new Fleet(*fleet);
}
+ //m_Fleet->printFleet();
fillTable();
}
m_RoidsEditView->setValue(tr("eonium"),pl->roids(tr("eonium").latin1()));
m_RoidsEditView->setValue(tr("uninit"),pl->roids(tr("uninit").latin1()));
}
+ slotViewTickRange();
}
/////////////////////////////////////////////////////////////////////
}
}
+/////////////////////////////////////////////////////////////////////
+//
+void FleetView::slotViewTickRange(int min = -1, int max = -1)
+{
+ if (min > -1)
+ m_iMinTick = min;
+ if (max > -1)
+ m_iMaxTick = max;
+
+ int before = 0;
+ int after = 0;
+ for(vector<QString>::iterator i = m_Names.begin(); i != m_Names.end(); ++i)
+ {
+ int show;
+ if (m_iResultMode == 1) //Blocked
+ {
+ show = m_Fleet->blockedFleet(i->latin1(), m_iMaxTick);
+ }
+ else if (m_iResultMode == 2) //Survived
+ {
+ show = m_Fleet->fleet(i->latin1(), m_iMaxTick);
+ }
+ else
+ {
+ before = m_Fleet->fleet(i->latin1(), m_iMinTick);
+ after = m_Fleet->fleet(i->latin1(), m_iMaxTick);
+ show = after - before;
+ }
+ m_UnitsLostSurvivedView[(*i)]->setText(QString("%1").arg( show ));
+ }
+
+ int lost;
+
+ 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);
+
+ before = pl->planetScore(m_iMinTick);
+ after = pl->planetScore(m_iMaxTick);
+ lost = after - before;
+ m_RoidsEditView->slotSetLost(tr("scorelost"),lost);
+
+ m_RoidsEditView->slotSetLost(tr("capping"),pl->capping(m_iMaxTick));
+
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+void FleetView::slotSetResultMode(int i)
+{
+ m_iResultMode = i;
+ slotViewTickRange();
+}