//
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();
}
typedef std::map<std::string, std::vector<int> > FleetList;
typedef std::map<std::string, UnitType> UnitList;
typedef std::map<std::string, std::vector<int> > RaceList;
-//!This is the engine for the whole battlesystem.
-/**This is the engine for the whole battlesystem.
+//! An abstraction of a fleet and the engine for the battle simulation.
+/**This class and it's derivates is the engine for the whole battlesystem.
* One of the few parts that I plan make fully portable.
*\todo LOTS (I think ;)
*@author Michael Andreen
//////////////////////////////////////////////////////////////////////////
//
-void runBattle(std::vector<Fleet*> friendly, std::vector<Fleet*> hostile)
+void Planet::runBattle(std::vector<Fleet*> friendly, std::vector<Fleet*> hostile)
{
}
* real life, it's a game engine, and in this engine a planet got all the
* attributes that a fleet got + some additions, so I think the inheritance
* is fully legal from a OOP standpoint. If it isn't, then please correct me ;)
+ *
+ * This class is doing the actual battle simulation (since battles without
+ * planets aren't available in this game).
*@author Michael Andreen
*/