]> ruin.nu Git - hbs.git/blobdiff - bs/bsdoc.cpp
BSDoc should now create a friendly and a hostile vector for the battle simulation...
[hbs.git] / bs / bsdoc.cpp
index d7e04ce336f0e3253c04af305ae94952b0942d1b..9d3c21ba8c10323052bdd8a28be1282dadbbc8ea 100644 (file)
@@ -146,6 +146,22 @@ void BSDoc::removeFleet(QString battle, QString group, QString fleet)
 //
 void BSDoc::runBattleSimulation()
 {
+       for(BattleList::iterator i = m_Battles.begin(); i != m_Battles.end(); ++i)
+       {
+               map<QString, vector<Fleet*> > battle;
+               for (map<QString, map<QString, Fleet*> >::iterator j = i->second.begin(); j != i->second.end(); ++j)
+               {
+                       for (map<QString, Fleet*>::iterator k = j->second.begin(); k != j->second.end(); ++k)
+                               battle[j->first].push_back(k->second);
+               }
+
+               Planet* pl = dynamic_cast<Planet*>(i->second["Friendly"]["Home Planet"]);
+
+               if (pl)
+               {
+                       pl->runBattle(battle["Friendly"], battle["Hostile"]);
+               }
+       }
 
        emit documentChanged();
 }