X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=bs%2Fplanet.cpp;h=81d7daa4f09e66438844be23bc52d6b3f5e65200;hb=c2dd8856c3d97667953a0b73403b5e5cade5ce9b;hp=e8954e16e32700fcff56cdcd50c6c168c21bfeb0;hpb=33b6dc7ca95a05c26a78879413395c1588066b77;p=hbs.git diff --git a/bs/planet.cpp b/bs/planet.cpp index e8954e1..81d7daa 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -17,6 +17,8 @@ #include "planet.h" +using namespace std; + Planet::Planet() { m_sRace = "Planet"; @@ -26,12 +28,59 @@ Planet::Planet() Planet::~Planet(){ } -unsigned Planet::score(int tick = 0) +////////////////////////////////////////////////////////////////////////// +// +unsigned Planet::planetScore() const { return m_iScore; } -void Planet::setScore(unsigned i) +////////////////////////////////////////////////////////////////////////// +// +void Planet::setPlanetScore(unsigned i) { m_iScore = i; } + +////////////////////////////////////////////////////////////////////////// +// +int Planet::roids(std::string type, int tick = 0) const +{ + // const... I would like [] as for const types: int ticks = m_Roids[type].size(); + + vectorconst* roids = 0; + for (RoidList::const_iterator i = m_Roids.begin(); i != m_Roids.end(); ++i) + { + if (i->first == type) + { + roids = &i->second; + break; + } + } + if (roids == 0) + return 0; + + int ticks = roids->size(); + + if( ticks == 0) + return 0; + if (ticks < tick) + return roids->at(ticks); + return roids->at(tick); +} + +////////////////////////////////////////////////////////////////////////// +// +void Planet::setRoids(std::string type, int number) +{ + if (m_Roids[type].size() == 0) + m_Roids[type].push_back(number); + m_Roids[type][0] = number; +} + +////////////////////////////////////////////////////////////////////////// +// +void runBattle(std::vector friendly, std::vector hostile) +{ +} +