X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Fplanet.cpp;h=a5541cbebaee4b89dd68d5f79d9de96d6d94838a;hb=ac13ca5453360c59eaa0b8ad4242ea0837825bc1;hp=81d7daa4f09e66438844be23bc52d6b3f5e65200;hpb=c2dd8856c3d97667953a0b73403b5e5cade5ce9b;p=hbs.git diff --git a/bs/planet.cpp b/bs/planet.cpp index 81d7daa..a5541cb 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -80,7 +80,34 @@ void Planet::setRoids(std::string type, int number) ////////////////////////////////////////////////////////////////////////// // -void runBattle(std::vector friendly, std::vector hostile) +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 = calculateSide(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); + + calcOneTick(&allFriends, &allHostiles); + + allFriends.distributeLossesGains(friends, tick); + allHostiles.distributeLossesGains(friends, tick); + } +} + +////////////////////////////////////////////////////////////////////////// +// +void Planet::calcOneTick(Planet* friendly, Fleet* Hostile) { }