X-Git-Url: https://ruin.nu/git/?p=hbs.git;a=blobdiff_plain;f=bs%2Fplanet.cpp;h=c72fb4e61c39e5b9450cac19f3c97a82ac2b723f;hp=425861efbbf289afee2e6cd5518786bfd293f779;hb=f7ce9d1a41bdeab4f12110c6911f662dc6e06ca3;hpb=07acf9a898e295587b9034bee6b8682e11a97086 diff --git a/bs/planet.cpp b/bs/planet.cpp index 425861e..c72fb4e 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -17,9 +17,65 @@ #include "planet.h" +using namespace std; + Planet::Planet() { m_sRace = "Planet"; + m_iScore = 0; } + Planet::~Planet(){ } + +////////////////////////////////////////////////////////////////////////// +// +unsigned Planet::planetScore() const +{ + return m_iScore; +} + +////////////////////////////////////////////////////////////////////////// +// +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; +} + +