X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Fplanet.cpp;h=9c421ccc4b9b71abe7e58af0d96e7caed2a87f28;hb=3ae63f013b2ac281d17acec43bc054a132861d35;hp=69cfd7a432c2aee7edeb72f0d545126b6560b26c;hpb=0913ab8150ff07822ec8e20466c8feead013cdc5;p=hbs.git diff --git a/bs/planet.cpp b/bs/planet.cpp index 69cfd7a..9c421cc 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -81,6 +81,33 @@ void Planet::setRoids(std::string type, int number) ////////////////////////////////////////////////////////////////////////// // void Planet::runBattle(std::vector friendly, std::vector hostile) +{ + for(int tick = 1; ; ++tick) + { + //See who's in the battle at the current tick + vector friends = calculateSide(friendly, 6, tick); + vector hostiles = calcualteSide(hostile, 3, tick); + + // No idea to calculate anything if noone is there.. ;) + if (hostiles.size() == 0) + break; + + Planet allFriends; + allFriends.addToThis(friends); + + Fleet allHostiles; + allHostiles.addToThis(hostiles); + + calculateOneTick(&allFriends, &allHostiles); + + allFriends.distributeLossesGains(friends, tick); + allHostile.distributeLossesGains(friends, tick); + } +} + +////////////////////////////////////////////////////////////////////////// +// +void calcOneTick(Planet* friendly, Fleet* Hostile) { }